Skip to content

Commit

Permalink
Merge pull request #392 from bcgov/artifactory
Browse files Browse the repository at this point in the history
Artifactory
  • Loading branch information
TayGov authored Oct 23, 2024
2 parents 0a573c1 + 3e08ffc commit 25ab566
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 159 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/deploy-ai-reviewer-admin-ui-4.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/deploy-api-oc4.yml

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/dev-ai-reviewer-admin-build.yaml
Original file line number Diff line number Diff line change
@@ -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: [main]
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 "[email protected]"
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
88 changes: 88 additions & 0 deletions .github/workflows/dev-ai-reviewer-api-build.yaml
Original file line number Diff line number Diff line change
@@ -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: [main]
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 "[email protected]"
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
Loading

0 comments on commit 25ab566

Please sign in to comment.