From b2d1476ea02d044712e17b1300365d44afc37f4d Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Sun, 17 Sep 2023 14:59:27 +0000 Subject: [PATCH] add dev pipeline --- .github/workflows/MLMonitoringDevPipeline.yml | 46 +++++++++++++++++++ .github/workflows/MLPipelinePostMerge.yml | 15 +++--- 2 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/MLMonitoringDevPipeline.yml diff --git a/.github/workflows/MLMonitoringDevPipeline.yml b/.github/workflows/MLMonitoringDevPipeline.yml new file mode 100644 index 0000000..d419de0 --- /dev/null +++ b/.github/workflows/MLMonitoringDevPipeline.yml @@ -0,0 +1,46 @@ +name: Deployment for Dev Model + +on: + push: + tags: [ 'model#dev#*' ] + +permissions: write-all + +jobs: + + Register-Prediction-Image-Dev: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install packages to retrieve artifacts + run: | + pip install --upgrade pip + pip install -r modules/ml-pipeline/src/pipeline/src/requirements/version_control/requirements.txt + + - name: Retrieve artifacts (dvc.lock) + env: + AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }} + run: | + cd modules/ml-pipeline/src/pipeline/src + dvc pull -r dev + + - name: Build Prediction docker image (TODO - NEED LAMBDA IMAGE, need to add version from gto registry) + run: | + cd modules/ml-pipeline/src/pipeline/ + REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + docker build . --file Prediction.Dockerfile --tag ${REGISTER_MODEL_NAME} + + - name: ECR Login - Dev + env: + AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }} + run: | + echo "LOGIN TO ECR" + + - name: Push Prediction image to ECR - Dev + env: + AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }} + run: | + echo "PUSH TO ECR" diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index 95c85f8..d61f565 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -176,9 +176,6 @@ jobs: pip install -r modules/ml-pipeline/src/pipeline/src/requirements/version_control/requirements.txt - name: Register Model - env: - AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }} run: | REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') @@ -206,13 +203,13 @@ jobs: git tag -a ${new_tag} -m "Assigning stage dev to artifact ${REGISTER_MODEL_NAME} version ${latest_version}" git push origin ${new_tag} - # git checkout master - # git fetch --all + git checkout master + git fetch --all - # gto show > MODEL_REGISTRY.md - # git add . - # git commit -m "Update Registry" - # git push origin master + gto show > MODEL_REGISTRY.md + git add . + git commit -m "Update Registry" + git push origin master Register-Prediction-Image-Dev: