From 7347a021c601cd77c2fc45e0a9ae9176a1afb5ce Mon Sep 17 00:00:00 2001 From: jjstratton Date: Fri, 18 Oct 2024 10:47:37 -0700 Subject: [PATCH 1/2] new pipelines --- .../dev-ai-reviewer-admin-build.yaml | 85 ++++++++++++ .../workflows/dev-ai-reviewer-api-build.yaml | 88 +++++++++++++ .github/workflows/promote-prod.yaml | 121 ++++++++++++++++++ .github/workflows/promote-test.yaml | 121 ++++++++++++++++++ 4 files changed, 415 insertions(+) create mode 100644 .github/workflows/dev-ai-reviewer-admin-build.yaml create mode 100644 .github/workflows/dev-ai-reviewer-api-build.yaml create mode 100644 .github/workflows/promote-prod.yaml create mode 100644 .github/workflows/promote-test.yaml diff --git a/.github/workflows/dev-ai-reviewer-admin-build.yaml b/.github/workflows/dev-ai-reviewer-admin-build.yaml new file mode 100644 index 00000000..a05f3c16 --- /dev/null +++ b/.github/workflows/dev-ai-reviewer-admin-build.yaml @@ -0,0 +1,85 @@ +name: Build AI Reviewer Admin Docker Image and Push to Openshift Image Registry + +on: + schedule: + - cron: "0 0 * */3 *" + push: + branches: [artifactory] + paths: + - "src/frontend/ai-reviewer-admin/**" + - ".github/workflows/dev-ai-reviewer-admin-build.yaml" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Login to Artifactory + uses: docker/login-action@v1 + with: + registry: artifacts.developer.gov.bc.ca + username: ${{ secrets.EFILING_ARTIFACTORY_USERNAME }} + password: ${{ secrets.EFILING_ARTIFACTORY_PASSWORD }} + + - name: Build Image + working-directory: src/frontend/ai-reviewer-admin + run: | + docker build . --file Dockerfile --tag ai-reviewer-admin + docker tag ai-reviewer-admin artifacts.developer.gov.bc.ca/efc7-ai-reviewer-admin/ai-reviewer-admin:dev + + - name: Docker Push to Artifactory + run: | + docker push artifacts.developer.gov.bc.ca/efc7-ai-reviewer-admin/ai-reviewer-admin:dev + + # Get SHORT_SHA for the version + - name: Get short SHA + id: short_sha + run: | + echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" + echo "Short SHA: $SHORT_SHA" + +# - name: Checkout ArgoCD Repo +# id: gitops +# uses: actions/checkout@v4 +# with: +# repository: bcgov-c/tenant-gitops-fc726a +# ref: develop +# token: ${{ secrets.ARGO_PAT }} # `ARGO_PAT` is a secret that contains your PAT +# path: gitops +# +# - name: Update Helm Values and Commit +# id: helm +# if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful +# run: | +# # Clone the GitOps deployment configuration repository +# # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and +# cd gitops/charts +# +# # Update the Helm values file with the new image tag and version +# DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time +# +# sed -i "s/aiadmintag: .*/aiadmintag: dev # Image Updated on $DATETIME/" ../deploy/dev_values.yaml +# sed -i "s/aiAdminVersion: .*/aiAdminVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/dev_values.yaml +# +# # Commit and push the changes +# git config --global user.email "actions@github.com" +# git config --global user.name "GitHub Actions" +# +# git add . +# +# git add ../deploy/dev_values.yaml +# +# # Repackage Helm Chart +# +# cd efiling-gitops +# +# helm dependency build +# +# cd charts +# +# git add . +# +# git commit -m "Update Dev AI Reviewer Admin image tag" +# git push origin develop # Update the branch name as needed \ No newline at end of file diff --git a/.github/workflows/dev-ai-reviewer-api-build.yaml b/.github/workflows/dev-ai-reviewer-api-build.yaml new file mode 100644 index 00000000..43af241b --- /dev/null +++ b/.github/workflows/dev-ai-reviewer-api-build.yaml @@ -0,0 +1,88 @@ +name: Build AI Reviewer Admin Docker Image and Push to Openshift Image Registry + +on: + schedule: + - cron: "0 0 * */3 *" + push: + branches: [artifactory] + paths: + - "src/backend/**" + - ".github/workflows/dev-ai-reviewer-api-build.yaml" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Login to Artifactory + uses: docker/login-action@v1 + with: + registry: artifacts.developer.gov.bc.ca + username: ${{ secrets.EFILING_ARTIFACTORY_USERNAME }} + password: ${{ secrets.EFILING_ARTIFACTORY_PASSWORD }} + + - name: Build Image + env: + MVN_PROFILE: ai-reviewer,splunk + COMPOSE_DOCKER_CLI_BUILD: 1 + DOCKER_BUILDKIT: 1 + run: | + docker compose build ai-reviewer-api + docker tag jag-ai-reviewer-ai-reviewer-api artifacts.developer.gov.bc.ca/efc7-ai-reviewer-api/ai-reviewer-api:dev + + - name: Docker Push to Artifactory + run: | + docker push artifacts.developer.gov.bc.ca/efc7-ai-reviewer-api/ai-reviewer-api:dev + + # Get SHORT_SHA for the version + - name: Get short SHA + id: short_sha + run: | + echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" + echo "Short SHA: $SHORT_SHA" + +# - name: Checkout ArgoCD Repo +# id: gitops +# uses: actions/checkout@v4 +# with: +# repository: bcgov-c/tenant-gitops-fc726a +# ref: develop +# token: ${{ secrets.ARGO_PAT }} # `ARGO_PAT` is a secret that contains your PAT +# path: gitops +# +# - name: Update Helm Values and Commit +# id: helm +# if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful +# run: | +# # Clone the GitOps deployment configuration repository +# # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and +# cd gitops/charts +# +# # Update the Helm values file with the new image tag and version +# DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time +# +# sed -i "s/aiapitag: .*/aiapitag: dev # Image Updated on $DATETIME/" ../deploy/dev_values.yaml +# sed -i "s/aiApiVersion: .*/aiApiVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/dev_values.yaml +# +# # Commit and push the changes +# git config --global user.email "actions@github.com" +# git config --global user.name "GitHub Actions" +# +# git add . +# +# git add ../deploy/dev_values.yaml +# +# # Repackage Helm Chart +# +# cd efiling-gitops +# +# helm dependency build +# +# cd charts +# +# git add . +# +# git commit -m "Update Dev AI Reviewer API image tag" +# git push origin develop # Update the branch name as needed \ No newline at end of file diff --git a/.github/workflows/promote-prod.yaml b/.github/workflows/promote-prod.yaml new file mode 100644 index 00000000..9b8eb069 --- /dev/null +++ b/.github/workflows/promote-prod.yaml @@ -0,0 +1,121 @@ +# Deploy an artifact onto Prod +name: Promote to Prod +on: + workflow_dispatch: + inputs: + application: + required: true + description: What application you want to promote? + type: choice + options: + - ai-reviewer-api + - ai-reviewer-admin + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Login to Artifactory + uses: docker/login-action@v1 + with: + registry: artifacts.developer.gov.bc.ca + username: ${{ secrets.EFILING_ARTIFACTORY_USERNAME }} + password: ${{ secrets.EFILING_ARTIFACTORY_PASSWORD }} + + - name: Docker Pull Test Image from Artifactory + working-directory: ${{env.WORKING_DIRECTORY}} + run: | + docker pull artifacts.developer.gov.bc.ca/efc7-${{ github.event.inputs.application }}/${{ github.event.inputs.application }}:test + + - name: Docker Push Prod Image To Artifactory + working-directory: ${{env.WORKING_DIRECTORY}} + run: | + docker push artifacts.developer.gov.bc.ca/efc7-${{ github.event.inputs.application }}/${{ github.event.inputs.application }}:prod + + # Get SHORT_SHA for the version + - name: Get short SHA + id: short_sha + run: | + echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" + echo "Short SHA: $SHORT_SHA" + + - name: Checkout ArgoCD Repo + id: gitops + uses: actions/checkout@v4 + with: + repository: bcgov-c/tenant-gitops-fc726a + ref: stage + token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT + path: gitops + + - name: Update ADMIN Helm Values and Commit + id: helm-admin + if: ${{ github.event.inputs.application == 'ai-reviewer-admin' }} + run: | + # Clone the GitOps deployment configuration repository + # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and + cd gitops/charts + + # Update the Helm values file with the new image tag and version + DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time + + sed -i "s/aiadmintag: .*/aiadmintag: prod # Image Updated on $DATETIME/" ../deploy/prod_values.yaml + sed -i "s/aiAdminVersion: .*/aiAdminVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/prod_values.yaml + + # Commit and push the changes + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + git add . + + git add ../deploy/prod_values.yaml + + # Repackage Helm Chart + + cd efiling-gitops + + helm dependency build + + cd charts + + git add . + + git commit -m "Update Prod AI Reviewer Admin image tag" + git push origin stage # Update the branch name as needed + + - name: Update API Helm Values and Commit + id: helm-api + if: ${{ github.event.inputs.application == 'ai-reviewer-api' }} + run: | + # Clone the GitOps deployment configuration repository + # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and + cd gitops/charts + + # Update the Helm values file with the new image tag and version + DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time + + sed -i "s/aiapitag: .*/aiapitag: prod # Image Updated on $DATETIME/" ../deploy/prod_values.yaml + sed -i "s/aiApiVersion: .*/aiApiVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/prod_values.yaml + + # Commit and push the changes + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + git add . + + git add ../deploy/prod_values.yaml + + # Repackage Helm Chart + + cd efiling-gitops + + helm dependency build + + cd charts + + git add . + + git commit -m "Update Prod AI Reviewer API image tag" + git push origin stage # Update the branch name as needed \ No newline at end of file diff --git a/.github/workflows/promote-test.yaml b/.github/workflows/promote-test.yaml new file mode 100644 index 00000000..60214591 --- /dev/null +++ b/.github/workflows/promote-test.yaml @@ -0,0 +1,121 @@ +# Deploy an artifact onto Test +name: Promote to Test +on: + workflow_dispatch: + inputs: + application: + required: true + description: What application you want to promote? + type: choice + options: + - ai-reviewer-api + - ai-reviewer-admin + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Login to Artifactory + uses: docker/login-action@v1 + with: + registry: artifacts.developer.gov.bc.ca + username: ${{ secrets.EFILING_ARTIFACTORY_USERNAME }} + password: ${{ secrets.EFILING_ARTIFACTORY_PASSWORD }} + + - name: Docker Pull Dev Image from Artifactory + working-directory: ${{env.WORKING_DIRECTORY}} + run: | + docker pull artifacts.developer.gov.bc.ca/efc7-${{ github.event.inputs.application }}/${{ github.event.inputs.application }}:dev + + - name: Docker Push Test Image To Artifactory + working-directory: ${{env.WORKING_DIRECTORY}} + run: | + docker push artifacts.developer.gov.bc.ca/efc7-${{ github.event.inputs.application }}/${{ github.event.inputs.application }}:test + + # Get SHORT_SHA for the version + - name: Get short SHA + id: short_sha + run: | + echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" + echo "Short SHA: $SHORT_SHA" + + - name: Checkout ArgoCD Repo + id: gitops + uses: actions/checkout@v4 + with: + repository: bcgov-c/tenant-gitops-fc726a + ref: test + token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT + path: gitops + + - name: Update ADMIN Helm Values and Commit + id: helm-admin + if: ${{ github.event.inputs.application == 'ai-reviewer-admin' }} + run: | + # Clone the GitOps deployment configuration repository + # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and + cd gitops/charts + + # Update the Helm values file with the new image tag and version + DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time + + sed -i "s/aiadmintag: .*/aiadmintag: test # Image Updated on $DATETIME/" ../deploy/test_values.yaml + sed -i "s/aiAdminVersion: .*/aiAdminVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/test_values.yaml + + # Commit and push the changes + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + git add . + + git add ../deploy/test_values.yaml + + # Repackage Helm Chart + + cd efiling-gitops + + helm dependency build + + cd charts + + git add . + + git commit -m "Update Test AI Reviewer Admin image tag" + git push origin test # Update the branch name as needed + + - name: Update API Helm Values and Commit + id: helm-api + if: ${{ github.event.inputs.application == 'ai-reviewer-api' }} + run: | + # Clone the GitOps deployment configuration repository + # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and + cd gitops/charts + + # Update the Helm values file with the new image tag and version + DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time + + sed -i "s/aiapitag: .*/aiapitag: test # Image Updated on $DATETIME/" ../deploy/test_values.yaml + sed -i "s/aiApiVersion: .*/aiApiVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/test_values.yaml + + # Commit and push the changes + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + git add . + + git add ../deploy/test_values.yaml + + # Repackage Helm Chart + + cd efiling-gitops + + helm dependency build + + cd charts + + git add . + + git commit -m "Update Test AI Reviewer API image tag" + git push origin test # Update the branch name as needed \ No newline at end of file From 3e08ffc5fd3a6d459919e9edf826e19cd561c96d Mon Sep 17 00:00:00 2001 From: jjstratton Date: Fri, 18 Oct 2024 11:34:44 -0700 Subject: [PATCH 2/2] updated --- .../deploy-ai-reviewer-admin-ui-4.yml | 57 ------------ .github/workflows/deploy-api-oc4.yml | 47 ---------- .../dev-ai-reviewer-admin-build.yaml | 88 +++++++++---------- .../workflows/dev-ai-reviewer-api-build.yaml | 88 +++++++++---------- .github/workflows/promote.yml | 55 ------------ 5 files changed, 88 insertions(+), 247 deletions(-) delete mode 100644 .github/workflows/deploy-ai-reviewer-admin-ui-4.yml delete mode 100644 .github/workflows/deploy-api-oc4.yml delete mode 100644 .github/workflows/promote.yml diff --git a/.github/workflows/deploy-ai-reviewer-admin-ui-4.yml b/.github/workflows/deploy-ai-reviewer-admin-ui-4.yml deleted file mode 100644 index 60df711d..00000000 --- a/.github/workflows/deploy-ai-reviewer-admin-ui-4.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Deploy AI Reviewer Admin to Openshift 4 Registry - -on: - schedule: - - cron: "0 0 * */3 *" - push: - branches: [main] - paths: - - "src/frontend/ai-reviewer-admin/**" - - ".github/workflows/deploy-ai-reviewer-admin-ui.yml" - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Print GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: | - echo "The event name is ${{ github.event_name }}" - echo "$GITHUB_CONTEXT" - - - name: Get Source - uses: actions/checkout@v2 - - - name: Build the Docker image - working-directory: src/frontend/ai-reviewer-admin - run: | - docker build . --file Dockerfile --tag ai-reviewer-admin - - - name: Cluster Login OC4 - uses: redhat-developer/openshift-actions@v1.1 - with: - openshift_server_url: ${{ secrets.OPENSHIFT4_SERVER_URL }} - parameters: '{"apitoken": "${{ secrets.OPENSHIFT4_SA_PASSWORD }}"}' - cmd: | - 'version' - - - name: Login to Openshift OC4 - run : | - docker login ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }} -u ${{ secrets.OPENSHIFT4_SA_USERNAME }} -p ${{ secrets.OPENSHIFT4_SA_PASSWORD }} - - - name: Tag the Docker image OC4 - run: | - docker tag ai-reviewer-admin ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT4_TOOLS_NAMESPACE }}/ai-reviewer-admin:latest - - - name: Push the Docker image OC4 - run: | - docker push ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT4_TOOLS_NAMESPACE }}/ai-reviewer-admin:latest - - - name: Logout OC4 - run: | - docker logout diff --git a/.github/workflows/deploy-api-oc4.yml b/.github/workflows/deploy-api-oc4.yml deleted file mode 100644 index b17f8d6f..00000000 --- a/.github/workflows/deploy-api-oc4.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Deploy API to Openshift 4 Registry - -on: - schedule: - - cron: "0 0 * */3 *" - push: - branches: [main] - paths: - - "src/backend/**" - - ".github/workflows/deploy-api-oc4.yml" - workflow_dispatch: {} - -jobs: - git_sha: - uses: SierraSystems/reusable-workflows/.github/workflows/get-github-commitversion.yml@main - with: - working_directory: "." - - build: - needs: - - git_sha - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Login to the Openshift Cluster - run: | - oc login --token=${{ secrets.OPENSHIFT4_SA_PASSWORD }} --server=${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }} - - - name: Login to Openshift Docker - run : | - docker login ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }} -u ${{ secrets.OPENSHIFT4_SA_USERNAME }} -p ${{ secrets.OPENSHIFT4_SA_PASSWORD }} - - name: Build the Docker image - env: - MVN_PROFILE: ai-reviewer,splunk - COMPOSE_DOCKER_CLI_BUILD: 1 - DOCKER_BUILDKIT: 1 - run: | - - docker-compose build ai-reviewer-api - - docker tag jag-ai-reviewer_ai-reviewer-api ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT4_TOOLS_NAMESPACE }}/ai-reviewer-api:latest - docker push ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT4_TOOLS_NAMESPACE }}/ai-reviewer-api:latest - - docker tag jag-ai-reviewer_ai-reviewer-api ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT4_TOOLS_NAMESPACE }}/ai-reviewer-api:${{ needs.git_sha.outputs.github-release-version }} - docker push ${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}/${{ secrets.OPENSHIFT4_TOOLS_NAMESPACE }}/ai-reviewer-api:${{ needs.git_sha.outputs.github-release-version }} diff --git a/.github/workflows/dev-ai-reviewer-admin-build.yaml b/.github/workflows/dev-ai-reviewer-admin-build.yaml index a05f3c16..e29a4613 100644 --- a/.github/workflows/dev-ai-reviewer-admin-build.yaml +++ b/.github/workflows/dev-ai-reviewer-admin-build.yaml @@ -4,7 +4,7 @@ on: schedule: - cron: "0 0 * */3 *" push: - branches: [artifactory] + branches: [main] paths: - "src/frontend/ai-reviewer-admin/**" - ".github/workflows/dev-ai-reviewer-admin-build.yaml" @@ -40,46 +40,46 @@ jobs: echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" echo "Short SHA: $SHORT_SHA" -# - name: Checkout ArgoCD Repo -# id: gitops -# uses: actions/checkout@v4 -# with: -# repository: bcgov-c/tenant-gitops-fc726a -# ref: develop -# token: ${{ secrets.ARGO_PAT }} # `ARGO_PAT` is a secret that contains your PAT -# path: gitops -# -# - name: Update Helm Values and Commit -# id: helm -# if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful -# run: | -# # Clone the GitOps deployment configuration repository -# # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and -# cd gitops/charts -# -# # Update the Helm values file with the new image tag and version -# DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time -# -# sed -i "s/aiadmintag: .*/aiadmintag: dev # Image Updated on $DATETIME/" ../deploy/dev_values.yaml -# sed -i "s/aiAdminVersion: .*/aiAdminVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/dev_values.yaml -# -# # Commit and push the changes -# git config --global user.email "actions@github.com" -# git config --global user.name "GitHub Actions" -# -# git add . -# -# git add ../deploy/dev_values.yaml -# -# # Repackage Helm Chart -# -# cd efiling-gitops -# -# helm dependency build -# -# cd charts -# -# git add . -# -# git commit -m "Update Dev AI Reviewer Admin image tag" -# git push origin develop # Update the branch name as needed \ No newline at end of file + - name: Checkout ArgoCD Repo + id: gitops + uses: actions/checkout@v4 + with: + repository: bcgov-c/tenant-gitops-fc726a + ref: develop + token: ${{ secrets.ARGO_PAT }} # `ARGO_PAT` is a secret that contains your PAT + path: gitops + + - name: Update Helm Values and Commit + id: helm + if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful + run: | + # Clone the GitOps deployment configuration repository + # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and + cd gitops/charts + + # Update the Helm values file with the new image tag and version + DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time + + sed -i "s/aiadmintag: .*/aiadmintag: dev # Image Updated on $DATETIME/" ../deploy/dev_values.yaml + sed -i "s/aiAdminVersion: .*/aiAdminVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/dev_values.yaml + + # Commit and push the changes + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + git add . + + git add ../deploy/dev_values.yaml + + # Repackage Helm Chart + + cd efiling-gitops + + helm dependency build + + cd charts + + git add . + + git commit -m "Update Dev AI Reviewer Admin image tag" + git push origin develop # Update the branch name as needed \ No newline at end of file diff --git a/.github/workflows/dev-ai-reviewer-api-build.yaml b/.github/workflows/dev-ai-reviewer-api-build.yaml index 43af241b..64024d85 100644 --- a/.github/workflows/dev-ai-reviewer-api-build.yaml +++ b/.github/workflows/dev-ai-reviewer-api-build.yaml @@ -4,7 +4,7 @@ on: schedule: - cron: "0 0 * */3 *" push: - branches: [artifactory] + branches: [main] paths: - "src/backend/**" - ".github/workflows/dev-ai-reviewer-api-build.yaml" @@ -43,46 +43,46 @@ jobs: echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" echo "Short SHA: $SHORT_SHA" -# - name: Checkout ArgoCD Repo -# id: gitops -# uses: actions/checkout@v4 -# with: -# repository: bcgov-c/tenant-gitops-fc726a -# ref: develop -# token: ${{ secrets.ARGO_PAT }} # `ARGO_PAT` is a secret that contains your PAT -# path: gitops -# -# - name: Update Helm Values and Commit -# id: helm -# if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful -# run: | -# # Clone the GitOps deployment configuration repository -# # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and -# cd gitops/charts -# -# # Update the Helm values file with the new image tag and version -# DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time -# -# sed -i "s/aiapitag: .*/aiapitag: dev # Image Updated on $DATETIME/" ../deploy/dev_values.yaml -# sed -i "s/aiApiVersion: .*/aiApiVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/dev_values.yaml -# -# # Commit and push the changes -# git config --global user.email "actions@github.com" -# git config --global user.name "GitHub Actions" -# -# git add . -# -# git add ../deploy/dev_values.yaml -# -# # Repackage Helm Chart -# -# cd efiling-gitops -# -# helm dependency build -# -# cd charts -# -# git add . -# -# git commit -m "Update Dev AI Reviewer API image tag" -# git push origin develop # Update the branch name as needed \ No newline at end of file + - name: Checkout ArgoCD Repo + id: gitops + uses: actions/checkout@v4 + with: + repository: bcgov-c/tenant-gitops-fc726a + ref: develop + token: ${{ secrets.ARGO_PAT }} # `ARGO_PAT` is a secret that contains your PAT + path: gitops + + - name: Update Helm Values and Commit + id: helm + if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful + run: | + # Clone the GitOps deployment configuration repository + # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and + cd gitops/charts + + # Update the Helm values file with the new image tag and version + DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time + + sed -i "s/aiapitag: .*/aiapitag: dev # Image Updated on $DATETIME/" ../deploy/dev_values.yaml + sed -i "s/aiApiVersion: .*/aiApiVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/dev_values.yaml + + # Commit and push the changes + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + git add . + + git add ../deploy/dev_values.yaml + + # Repackage Helm Chart + + cd efiling-gitops + + helm dependency build + + cd charts + + git add . + + git commit -m "Update Dev AI Reviewer API image tag" + git push origin develop # Update the branch name as needed \ No newline at end of file diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml deleted file mode 100644 index 3894a5fc..00000000 --- a/.github/workflows/promote.yml +++ /dev/null @@ -1,55 +0,0 @@ -# Deploy an artifact onto Dev, Test, or Prod -name: Promote -run-name: |- - Promoting the image ${{ github.event.inputs.application }}:${{ github.event.inputs.source_image_tag }} - to ${{ github.event.inputs.environment }} - -on: - workflow_dispatch: - inputs: - application: - required: true - description: What application you want to promote? - type: choice - options: - - ai-reviewer-api - - ai-reviewer-admin - source_image_tag: - required: true - description: What is the tag that is going to be promoted? - type: string - default: dev - environment: - required: true - description: What is the targeted environment? - type: choice - options: - - dev - - test - - prod - -jobs: - - approval: - name: "Wait for approval to deploy onto ${{ github.event.inputs.environment }}" - runs-on: ubuntu-latest - environment: ${{ github.event.inputs.environment }} - steps: - - name: "Approval Log" - run: |- - echo "The deployment of ${{ github.event.inputs.application }}:${{ github.event.inputs.source_image_tag }} \n - to ${{ github.event.inputs.environment }} was approved." - - promote_image: - needs: - - approval - uses: SierraSystems/reusable-workflows/.github/workflows/openshift-tag-image.yml@main - with: - image_stream_name: "${{ github.event.inputs.application }}" - source_image_tag: "${{ github.event.inputs.source_image_tag }}" - image_tags: "${{ github.event.inputs.environment }}" - secrets: - openshift_namespace: "${{ secrets.OPENSHIFT_LICENSE_PLATE_SILVER }}-tools" - openshift_server_url: "${{ secrets.OPENSHIFT4_SERVER_URL }}" - openshift_token: "${{ secrets.OPENSHIFT_SA_PIPELINE_TOKEN_SILVER }}" - openshift_external_repository: "${{ secrets.OPENSHIFT4_EXTERNAL_REPOSITORY }}"