mirror of
https://github.com/Hestia-Homes/ML.git
synced 2026-06-30 13:10:43 +00:00
update the workflow files
This commit is contained in:
parent
637ea9d5e2
commit
a62c2f09fd
3 changed files with 309 additions and 297 deletions
18
.github/workflows/Deploy.yml
vendored
18
.github/workflows/Deploy.yml
vendored
|
|
@ -2,7 +2,17 @@ name: Sap Change Model Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ sap-dev, sap-prod, heat-dev, heat-prod, carbon-dev, carbon-prod]
|
branches:
|
||||||
|
[
|
||||||
|
sap-dev,
|
||||||
|
sap-prod,
|
||||||
|
heat-dev,
|
||||||
|
heat-prod,
|
||||||
|
carbon-dev,
|
||||||
|
carbon-prod,
|
||||||
|
carbon_baseline-dev,
|
||||||
|
carbon-baseline-prod,
|
||||||
|
]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
|
|
@ -31,8 +41,8 @@ jobs:
|
||||||
- name: set secret prefix which is used across multiple steps
|
- name: set secret prefix which is used across multiple steps
|
||||||
id: secret_prefix
|
id: secret_prefix
|
||||||
run: |
|
run: |
|
||||||
# Convert branch name to uppercase and replace hyphens with underscores
|
# Convert branch name to uppercase and replace hyphens with underscores
|
||||||
echo "::set-output name=secret_prefix::$(echo "${{ github.ref_name }}" | tr 'a-z-' 'A-Z_')"
|
echo "::set-output name=secret_prefix::$(echo "${{ github.ref_name }}" | tr 'a-z-' 'A-Z_')"
|
||||||
|
|
||||||
- name: Set domain name
|
- name: Set domain name
|
||||||
id: set_domain
|
id: set_domain
|
||||||
|
|
@ -116,7 +126,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
RUNTIME_ENVIRONMENT: ${{ steps.set_runtime_environment.outputs.runtime_environment }}
|
RUNTIME_ENVIRONMENT: ${{ steps.set_runtime_environment.outputs.runtime_environment }}
|
||||||
PREDICTIONS_BUCKET: ${{ steps.set_s3_buckets.outputs.predictions_bucket }}
|
PREDICTIONS_BUCKET: ${{ steps.set_s3_buckets.outputs.predictions_bucket }}
|
||||||
DATA_BUCKET: ${{ steps.set_s3_buckets.outputs.data_bucket }}
|
DATA_BUCKET: ${{ steps.set_s3_buckets.outputs.data_bucket }}
|
||||||
DOMAIN_NAME: ${{ steps.set_domain.outputs.domain }}
|
DOMAIN_NAME: ${{ steps.set_domain.outputs.domain }}
|
||||||
ECR_URI: ${{ steps.set_ecr_credentials.outputs.ecr_uri }}
|
ECR_URI: ${{ steps.set_ecr_credentials.outputs.ecr_uri }}
|
||||||
GITHUB_SHA: ${{ github.sha }}
|
GITHUB_SHA: ${{ github.sha }}
|
||||||
|
|
|
||||||
316
.github/workflows/MLPipelinePostMerge.yml
vendored
316
.github/workflows/MLPipelinePostMerge.yml
vendored
|
|
@ -13,6 +13,7 @@ on:
|
||||||
- "sap-dev"
|
- "sap-dev"
|
||||||
- "heat-dev"
|
- "heat-dev"
|
||||||
- "carbon-dev"
|
- "carbon-dev"
|
||||||
|
- "carbon_baseline-dev"
|
||||||
|
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
|
|
||||||
|
|
@ -21,166 +22,171 @@ jobs:
|
||||||
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }}
|
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install packages to register model
|
- name: Install packages to register model
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||||
|
|
||||||
- name: Register Model
|
- name: Register Model
|
||||||
run: |
|
run: |
|
||||||
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
||||||
# REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
# REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
||||||
|
|
||||||
git config user.name "Github-Bot"
|
git config user.name "Github-Bot"
|
||||||
git config user.email "Github-Bot@no-reply.com"
|
git config user.email "Github-Bot@no-reply.com"
|
||||||
|
|
||||||
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') || false
|
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') || false
|
||||||
if [ -z "${latest_version}" ]; then
|
if [ -z "${latest_version}" ]; then
|
||||||
increment_version="1.0.0"
|
increment_version="1.0.0"
|
||||||
else
|
else
|
||||||
increment_version=$(echo ${latest_version} | awk 'BEGIN {
|
increment_version=$(echo ${latest_version} | awk 'BEGIN {
|
||||||
FS="\\." # Set the field separator to a period
|
FS="\\." # Set the field separator to a period
|
||||||
OFS="." # Set the output field separator to a period
|
OFS="." # Set the output field separator to a period
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
major = $1 + 1 # Increment the major version
|
major = $1 + 1 # Increment the major version
|
||||||
print major, "0", "0" # Print the new version
|
print major, "0", "0" # Print the new version
|
||||||
}')
|
}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new_tag=${REGISTER_MODEL_NAME}@v${increment_version}
|
new_tag=${REGISTER_MODEL_NAME}@v${increment_version}
|
||||||
|
|
||||||
git tag -a ${new_tag} -m "Registering new Major Version"
|
git tag -a ${new_tag} -m "Registering new Major Version"
|
||||||
git push origin ${new_tag}
|
git push origin ${new_tag}
|
||||||
|
|
||||||
gto show --json > MODEL_REGISTRY.md
|
gto show --json > MODEL_REGISTRY.md
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Update Registry"
|
git commit -m "Update Registry"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
Register-Minor-Model-Dev:
|
Register-Minor-Model-Dev:
|
||||||
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'minor')) }}
|
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'minor')) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install packages to register model
|
- name: Install packages to register model
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||||
|
|
||||||
- name: Register Model
|
- name: Register Model
|
||||||
run: |
|
run: |
|
||||||
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
||||||
# REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
# REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
||||||
|
|
||||||
git config user.name "Github-Bot"
|
git config user.name "Github-Bot"
|
||||||
git config user.email "Github-Bot@no-reply.com"
|
git config user.email "Github-Bot@no-reply.com"
|
||||||
|
|
||||||
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}')
|
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}')
|
||||||
if [ -z "${latest_version}" ]; then
|
if [ -z "${latest_version}" ]; then
|
||||||
increment_version="0.1.0"
|
increment_version="0.1.0"
|
||||||
else
|
else
|
||||||
increment_version=$(echo ${latest_version} | awk 'BEGIN {
|
increment_version=$(echo ${latest_version} | awk 'BEGIN {
|
||||||
FS="\\." # Set the field separator to a period
|
FS="\\." # Set the field separator to a period
|
||||||
OFS="." # Set the output field separator to a period
|
OFS="." # Set the output field separator to a period
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
minor = $2 + 1 # Increment the minor version
|
minor = $2 + 1 # Increment the minor version
|
||||||
print $1, minor, "0" # Print the new version
|
print $1, minor, "0" # Print the new version
|
||||||
}')
|
}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new_tag=${REGISTER_MODEL_NAME}@v${increment_version}
|
new_tag=${REGISTER_MODEL_NAME}@v${increment_version}
|
||||||
|
|
||||||
git tag -a ${new_tag} -m "Registering new Minor Version"
|
git tag -a ${new_tag} -m "Registering new Minor Version"
|
||||||
git push origin ${new_tag}
|
git push origin ${new_tag}
|
||||||
|
|
||||||
gto show --json > MODEL_REGISTRY.md
|
gto show --json > MODEL_REGISTRY.md
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Update Registry"
|
git commit -m "Update Registry"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
Register-Patch-Model-Dev:
|
Register-Patch-Model-Dev:
|
||||||
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'patch')) }}
|
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'patch')) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install packages to register model
|
- name: Install packages to register model
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||||
|
|
||||||
- name: Register Model
|
- name: Register Model
|
||||||
run: |
|
run: |
|
||||||
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
||||||
# REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
# REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
||||||
|
|
||||||
git config user.name "Github-Bot"
|
git config user.name "Github-Bot"
|
||||||
git config user.email "Github-Bot@no-reply.com"
|
git config user.email "Github-Bot@no-reply.com"
|
||||||
|
|
||||||
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}')
|
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}')
|
||||||
if [ -z "${latest_version}" ]; then
|
if [ -z "${latest_version}" ]; then
|
||||||
increment_version="0.0.1"
|
increment_version="0.0.1"
|
||||||
else
|
else
|
||||||
increment_version=$(echo ${latest_version} | awk 'BEGIN {
|
increment_version=$(echo ${latest_version} | awk 'BEGIN {
|
||||||
FS="\\." # Set the field separator to a period
|
FS="\\." # Set the field separator to a period
|
||||||
OFS="." # Set the output field separator to a period
|
OFS="." # Set the output field separator to a period
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
patch = $3 + 1 # Increment the patch version
|
patch = $3 + 1 # Increment the patch version
|
||||||
print $1, $2, patch # Print the new version
|
print $1, $2, patch # Print the new version
|
||||||
}')
|
}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new_tag=${REGISTER_MODEL_NAME}@v${increment_version}
|
new_tag=${REGISTER_MODEL_NAME}@v${increment_version}
|
||||||
|
|
||||||
git tag -a ${new_tag} -m "Registering new Patch Version"
|
git tag -a ${new_tag} -m "Registering new Patch Version"
|
||||||
git push origin ${new_tag}
|
git push origin ${new_tag}
|
||||||
|
|
||||||
gto show --json > MODEL_REGISTRY.md
|
gto show --json > MODEL_REGISTRY.md
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Update Registry"
|
git commit -m "Update Registry"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
Promote-Artefacts-To-Dev:
|
Promote-Artefacts-To-Dev:
|
||||||
if: github.event.pull_request.merged == true
|
if: github.event.pull_request.merged == true
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Install packages to retrieve artifacts
|
- name: Install packages to retrieve artifacts
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||||
|
|
||||||
- name: Retrieve artifacts (dvc.lock)
|
- name: Retrieve artifacts (dvc.lock)
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
cd modules/ml-pipeline/src/pipeline
|
cd modules/ml-pipeline/src/pipeline
|
||||||
dvc pull -r experiments
|
dvc pull -r experiments
|
||||||
|
|
||||||
- name: Push artifacts to Dev
|
- name: Push artifacts to Dev
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
cd modules/ml-pipeline/src/pipeline
|
cd modules/ml-pipeline/src/pipeline
|
||||||
dvc push -r dev
|
dvc push -r dev
|
||||||
|
|
||||||
Register-New-Model-Dev:
|
Register-New-Model-Dev:
|
||||||
needs: [Register-Major-Model-Dev, Register-Minor-Model-Dev, Register-Patch-Model-Dev]
|
needs:
|
||||||
|
[
|
||||||
|
Register-Major-Model-Dev,
|
||||||
|
Register-Minor-Model-Dev,
|
||||||
|
Register-Patch-Model-Dev,
|
||||||
|
]
|
||||||
if: |
|
if: |
|
||||||
always() &&
|
always() &&
|
||||||
(needs.Register-Major-Model-Dev.result == 'success' || needs.Register-Major-Model-Dev.result == 'skipped') &&
|
(needs.Register-Major-Model-Dev.result == 'success' || needs.Register-Major-Model-Dev.result == 'skipped') &&
|
||||||
|
|
@ -189,50 +195,50 @@ jobs:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install packages to register model
|
- name: Install packages to register model
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||||
|
|
||||||
- name: Register Model
|
- name: Register Model
|
||||||
env:
|
env:
|
||||||
TARGET_BRANCH: ${{ github.base_ref }}
|
TARGET_BRANCH: ${{ github.base_ref }}
|
||||||
run: |
|
run: |
|
||||||
|
|
||||||
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
||||||
# REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
# REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
||||||
|
|
||||||
git config user.name "Github-Bot"
|
git config user.name "Github-Bot"
|
||||||
git config user.email "Github-Bot@no-reply.com"
|
git config user.email "Github-Bot@no-reply.com"
|
||||||
|
|
||||||
latest_dev_version=$(gto history ${REGISTER_MODEL_NAME} --asc --plain | awk '{print $NF}' | awk '/dev/' | awk 'END {print}')
|
latest_dev_version=$(gto history ${REGISTER_MODEL_NAME} --asc --plain | awk '{print $NF}' | awk '/dev/' | awk 'END {print}')
|
||||||
if [ -z "${latest_dev_version}" ]; then
|
if [ -z "${latest_dev_version}" ]; then
|
||||||
increment_version="1"
|
increment_version="1"
|
||||||
else
|
else
|
||||||
increment_version=$(echo ${latest_dev_version} | awk '{print $NF}' | awk -F"#" '{print $3}' | awk '{$1++; print}')
|
increment_version=$(echo ${latest_dev_version} | awk '{print $NF}' | awk -F"#" '{print $3}' | awk '{$1++; print}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new_tag=${REGISTER_MODEL_NAME}#dev#${increment_version}
|
new_tag=${REGISTER_MODEL_NAME}#dev#${increment_version}
|
||||||
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@" '{print $2}')
|
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@" '{print $2}')
|
||||||
|
|
||||||
echo ${new_tag}
|
echo ${new_tag}
|
||||||
|
|
||||||
commit_hash=$(gto history ${REGISTER_MODEL_NAME} --asc --plain | awk "/${latest_version}/" | awk '{print $(NF-1)}')
|
commit_hash=$(gto history ${REGISTER_MODEL_NAME} --asc --plain | awk "/${latest_version}/" | awk '{print $(NF-1)}')
|
||||||
git checkout ${commit_hash}
|
git checkout ${commit_hash}
|
||||||
|
|
||||||
# git pull #Get new model registry md file changes
|
# git pull #Get new model registry md file changes
|
||||||
git tag -a ${new_tag} -m "Assigning stage dev to artifact ${REGISTER_MODEL_NAME} version ${latest_version}"
|
git tag -a ${new_tag} -m "Assigning stage dev to artifact ${REGISTER_MODEL_NAME} version ${latest_version}"
|
||||||
git push origin ${new_tag}
|
git push origin ${new_tag}
|
||||||
|
|
||||||
git checkout ${TARGET_BRANCH}
|
git checkout ${TARGET_BRANCH}
|
||||||
git fetch --all
|
git fetch --all
|
||||||
git pull
|
git pull
|
||||||
|
|
||||||
gto show --json > MODEL_REGISTRY.md
|
gto show --json > MODEL_REGISTRY.md
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Update Registry"
|
git commit -m "Update Registry"
|
||||||
git push origin ${TARGET_BRANCH}
|
git push origin ${TARGET_BRANCH}
|
||||||
|
|
|
||||||
272
.github/workflows/MLPipelinePullRequest.yml
vendored
272
.github/workflows/MLPipelinePullRequest.yml
vendored
|
|
@ -5,22 +5,21 @@ on:
|
||||||
# branches:
|
# branches:
|
||||||
# - "model-**"
|
# - "model-**"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["sap-dev", "heat-dev", "carbon-dev"]
|
branches: ["sap-dev", "heat-dev", "carbon-dev", "carbon_baseline-dev"]
|
||||||
label:
|
label:
|
||||||
types: ["created", "edited"]
|
types: ["created", "edited"]
|
||||||
|
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
Check-Label:
|
Check-Label:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: yogevbd/enforce-label-action@2.1.0
|
- uses: yogevbd/enforce-label-action@2.1.0
|
||||||
with:
|
with:
|
||||||
REQUIRED_LABELS_ANY: "major,minor,patch"
|
REQUIRED_LABELS_ANY: "major,minor,patch"
|
||||||
REQUIRED_LABELS_ANY_DESCRIPTION: "Select at least one label ['major','minor','patch']"
|
REQUIRED_LABELS_ANY_DESCRIPTION: "Select at least one label ['major','minor','patch']"
|
||||||
BANNED_LABELS: "banned"
|
BANNED_LABELS: "banned"
|
||||||
|
|
||||||
# No-Label:
|
# No-Label:
|
||||||
# if: ${{ github.event.label.name != 'major' }} || ${{ github.event.label.name != 'minor' }} || ${{ github.event.label.name != 'patch' }}
|
# if: ${{ github.event.label.name != 'major' }} || ${{ github.event.label.name != 'minor' }} || ${{ github.event.label.name != 'patch' }}
|
||||||
|
|
@ -31,161 +30,158 @@ jobs:
|
||||||
# run: |
|
# run: |
|
||||||
# echo "Please choose one of these tags: 'major', 'major', 'patch'"
|
# echo "Please choose one of these tags: 'major', 'major', 'patch'"
|
||||||
# exit(1)
|
# exit(1)
|
||||||
|
|
||||||
Verify-Lambda:
|
|
||||||
|
|
||||||
|
Verify-Lambda:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Install packages to retrieve artifacts
|
- name: Install packages to retrieve artifacts
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||||
- name: Retrieve artifacts (dvc.lock)
|
- name: Retrieve artifacts (dvc.lock)
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
cd modules/ml-pipeline/src/pipeline
|
cd modules/ml-pipeline/src/pipeline
|
||||||
dvc pull -r experiments
|
dvc pull -r experiments
|
||||||
- name: Set timestamp
|
- name: Set timestamp
|
||||||
id: set_timestamp
|
id: set_timestamp
|
||||||
run: |
|
run: |
|
||||||
echo "timestamp=$(date +%Y%m%d)" >> $GITHUB_ENV
|
echo "timestamp=$(date +%Y%m%d)" >> $GITHUB_ENV
|
||||||
echo "Generated timestamp: ${timestamp}"
|
echo "Generated timestamp: ${timestamp}"
|
||||||
- name: Upload sample row dataset to S3
|
- name: Upload sample row dataset to S3
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
cd modules/ml-pipeline/src/pipeline/data/prepared_data/
|
cd modules/ml-pipeline/src/pipeline/data/prepared_data/
|
||||||
aws s3 cp sample_test.parquet s3://retrofit-data-dev/sap_change_model/sample_data_for_cicd/${timestamp}/sample_test.parquet
|
aws s3 cp sample_test.parquet s3://retrofit-data-dev/sap_change_model/sample_data_for_cicd/${timestamp}/sample_test.parquet
|
||||||
- name: Build Lambda docker Image
|
- name: Build Lambda docker Image
|
||||||
run: |
|
run: |
|
||||||
docker build . --file ./deployment/Dockerfile.prediction.lambda --tag lambda_test
|
docker build . --file ./deployment/Dockerfile.prediction.lambda --tag lambda_test
|
||||||
- name: Run lambda docker container
|
- name: Run lambda docker container
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
docker run -d -p 9000:8080 \
|
docker run -d -p 9000:8080 \
|
||||||
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
|
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
|
||||||
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
|
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
|
||||||
-e RUNTIME_ENVIRONMENT=dev \
|
-e RUNTIME_ENVIRONMENT=dev \
|
||||||
-e PREDICTIONS_BUCKET=retrofit-sap-predictions-dev lambda_test
|
-e PREDICTIONS_BUCKET=retrofit-sap-predictions-dev lambda_test
|
||||||
- name: Test Lambda endpoint
|
- name: Test Lambda endpoint
|
||||||
run: |
|
run: |
|
||||||
sleep 2
|
sleep 2
|
||||||
curl -X POST "http://localhost:9000/2015-03-31/functions/function/invocations" \
|
curl -X POST "http://localhost:9000/2015-03-31/functions/function/invocations" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"body\": \"{\\\"file_location\\\": \\\"s3://retrofit-data-dev/sap_change_model/sample_data_for_cicd/${timestamp}/sample_test.parquet\\\", \\\"property_id\\\": 1, \\\"portfolio_id\\\": 4, \\\"created_at\\\": \\\"now\\\", \\\"warm\\\": true}\"}"
|
-d "{\"body\": \"{\\\"file_location\\\": \\\"s3://retrofit-data-dev/sap_change_model/sample_data_for_cicd/${timestamp}/sample_test.parquet\\\", \\\"property_id\\\": 1, \\\"portfolio_id\\\": 4, \\\"created_at\\\": \\\"now\\\", \\\"warm\\\": true}\"}"
|
||||||
- name: Get Lambda logs
|
- name: Get Lambda logs
|
||||||
run: |
|
run: |
|
||||||
docker logs $(docker ps -al -q)
|
docker logs $(docker ps -al -q)
|
||||||
- name: Test Lambda endpoint again
|
- name: Test Lambda endpoint again
|
||||||
run: |
|
run: |
|
||||||
sleep 2
|
sleep 2
|
||||||
curl -X POST "http://localhost:9000/2015-03-31/functions/function/invocations" \
|
curl -X POST "http://localhost:9000/2015-03-31/functions/function/invocations" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"body\": \"{\\\"file_location\\\": \\\"s3://retrofit-data-dev/sap_change_model/sample_data_for_cicd/${timestamp}/sample_test.parquet\\\", \\\"property_id\\\": 1, \\\"portfolio_id\\\": 4, \\\"created_at\\\": \\\"now\\\", \\\"testing\\\": true}\"}"
|
-d "{\"body\": \"{\\\"file_location\\\": \\\"s3://retrofit-data-dev/sap_change_model/sample_data_for_cicd/${timestamp}/sample_test.parquet\\\", \\\"property_id\\\": 1, \\\"portfolio_id\\\": 4, \\\"created_at\\\": \\\"now\\\", \\\"testing\\\": true}\"}"
|
||||||
- name: Get Lambda logs
|
- name: Get Lambda logs
|
||||||
run: |
|
run: |
|
||||||
docker logs $(docker ps -al -q)
|
docker logs $(docker ps -al -q)
|
||||||
- name: Stop Lambda container
|
- name: Stop Lambda container
|
||||||
run: |
|
run: |
|
||||||
docker stop lambda_test || echo "Container already stopped"
|
docker stop lambda_test || echo "Container already stopped"
|
||||||
- name: Remove uploaded sample row dataset from S3
|
- name: Remove uploaded sample row dataset from S3
|
||||||
if: always()
|
if: always()
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
aws s3 rm --recursive s3://retrofit-data-dev/sap_change_model/sample_data_for_cicd/${timestamp}/
|
aws s3 rm --recursive s3://retrofit-data-dev/sap_change_model/sample_data_for_cicd/${timestamp}/
|
||||||
|
|
||||||
Verify-Model:
|
Verify-Model:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Install packages to retrieve artifacts
|
- name: Install packages to retrieve artifacts
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||||
|
|
||||||
- name: Retrieve artifacts (dvc.lock)
|
- name: Retrieve artifacts (dvc.lock)
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
cd modules/ml-pipeline/src/pipeline
|
cd modules/ml-pipeline/src/pipeline
|
||||||
dvc pull -r experiments
|
dvc pull -r experiments
|
||||||
|
|
||||||
- name: Build Prediction docker Image
|
- name: Build Prediction docker Image
|
||||||
run: |
|
run: |
|
||||||
cd modules/ml-pipeline/src/
|
cd modules/ml-pipeline/src/
|
||||||
docker build . --file Prediction.Dockerfile --tag prediction_test
|
docker build . --file Prediction.Dockerfile --tag prediction_test
|
||||||
|
|
||||||
- name: Run Prediction docker container
|
- name: Run Prediction docker container
|
||||||
run: |
|
run: |
|
||||||
docker run prediction_test
|
docker run prediction_test
|
||||||
|
|
||||||
Trigger-CML:
|
Trigger-CML:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Install packages to retrieve artifacts
|
- name: Install packages to retrieve artifacts
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||||
|
|
||||||
- name: Retrieve artifacts (dvc.lock)
|
- name: Retrieve artifacts (dvc.lock)
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
cd modules/ml-pipeline/src/pipeline
|
cd modules/ml-pipeline/src/pipeline
|
||||||
dvc pull -r experiments
|
dvc pull -r experiments
|
||||||
|
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
- uses: iterative/setup-cml@v1
|
- uses: iterative/setup-cml@v1
|
||||||
- name: Generate report
|
- name: Generate report
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||||
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
TARGET_BRANCH: ${{ github.base_ref }}
|
TARGET_BRANCH: ${{ github.base_ref }}
|
||||||
run: |
|
run: |
|
||||||
cd modules/ml-pipeline/src/pipeline
|
cd modules/ml-pipeline/src/pipeline
|
||||||
echo "## Model metrics" > report.md
|
echo "## Model metrics" > report.md
|
||||||
|
|
||||||
# Compare metrics to master
|
# Compare metrics to master
|
||||||
git fetch --depth=1 origin ${TARGET_BRANCH}:${TARGET_BRANCH}
|
git fetch --depth=1 origin ${TARGET_BRANCH}:${TARGET_BRANCH}
|
||||||
dvc metrics diff --md --all ${TARGET_BRANCH} >> report.md
|
dvc metrics diff --md --all ${TARGET_BRANCH} >> report.md
|
||||||
|
|
||||||
echo "## Scenario comparison" >> report.md
|
echo "## Scenario comparison" >> report.md
|
||||||
|
|
||||||
cat metrics/scenario_table.md >> report.md
|
cat metrics/scenario_table.md >> report.md
|
||||||
|
|
||||||
echo "" >> report.md
|
echo "" >> report.md
|
||||||
|
|
||||||
echo "## Scenario metrics" >> report.md
|
echo "## Scenario metrics" >> report.md
|
||||||
|
|
||||||
cat metrics/scenario_metrics.md >> report.md
|
cat metrics/scenario_metrics.md >> report.md
|
||||||
|
|
||||||
cml comment create report.md
|
cml comment create report.md
|
||||||
|
|
||||||
# echo "## Residuals plot from model" >> report.md
|
# echo "## Residuals plot from model" >> report.md
|
||||||
# metrics_location=$(find . -maxdepth 10 -name "residuals.png")
|
# metrics_location=$(find . -maxdepth 10 -name "residuals.png")
|
||||||
# echo $metrics_location
|
# echo $metrics_location
|
||||||
# cd $metric_location
|
# cd $metric_location
|
||||||
# echo "" >> report.md
|
# echo "" >> report.md
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue