Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Wright authored and Lee Wright committed May 21, 2024
2 parents a5dfdef + daf8689 commit b8bc264
Show file tree
Hide file tree
Showing 858 changed files with 10,389 additions and 8,629 deletions.
80 changes: 79 additions & 1 deletion .github/workflows/build-push-admin-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ on:
env:
IMAGE_NAME: diam-admin-frontend
WORKING_DIRECTORY: ./diam-admin-ui

BRANCH_NAME: develop
VALUES_FILE: dev

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -19,6 +21,28 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set environment for branch
run: |
if [[ ${{ github.ref_name }} == 'main' ]]; then
echo "BRANCH_NAME=main" >> "$GITHUB_ENV"
echo "VALUES_FILE=prod" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'test' ]]; then
echo "BRANCH_NAME=test" >> "$GITHUB_ENV"
echo "VALUES_FILE=test" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'develop' ]]; then
echo "BRANCH_NAME=develop" >> "$GITHUB_ENV"
echo "VALUES_FILE=dev" >> "$GITHUB_ENV"
fi
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}

Expand All @@ -37,3 +61,57 @@ jobs:
- name: Docker Push to Artifactory
run: |
docker push artifacts.developer.gov.bc.ca/de27-general-docker/${{env.IMAGE_NAME}}:${GITHUB_REF##*/}
- name: Checkout ArgoCD Repo
id: gitops
if: steps.publish.outcome == 'success'
uses: actions/checkout@v4
with:
repository: bcgov-c/tenant-gitops-e27db1
ref: ${{ env.BRANCH_NAME }}
token: ${{ secrets.ARGO_PAT }} # access token
path: gitops

- 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: Update Helm Dev Values and Commit
id: helm
if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful
run: |
echo "Updating ${{ env.BRANCH_NAME }} helm values to trigger ArgoCD deployment "
# Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test
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
echo "Updating tag apitag: to ${{ steps.short_sha.outputs.SHORT_SHA }}"
sed -i "s/apitag: .*/apitag: ${{ env.VALUES_FILE }}-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" ../deploy/${{ env.VALUES_FILE }}_values.yaml
sed -i "s/apitag: .*/apitag: ${{ env.VALUES_FILE }}-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" admin-frontend/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/${{ env.VALUES_FILE }}_values.yaml

# Repackage Helm Chart

cd admin-frontend

helm dependency build

git add .

git commit -m "Update ${{ env.BRANCH_NAME }} API image tag"
git push origin ${{ env.BRANCH_NAME }} # Update the branch name as needed


53 changes: 43 additions & 10 deletions .github/workflows/build-push-approvalflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ name: diam-approvalflow

on:
push:
branches: [develop,test,main]
branches: [develop,test,main]
paths:
- "backend/ApprovalFlow/**"
- ".github/workflows/build-push-approvalflow.yml"
workflow_dispatch:
env:
IMAGE_NAME: diam-approvalflow
WORKING_DIRECTORY: ./backend
BRANCH_NAME: develop
VALUES_FILE: dev

jobs:
build:
Expand All @@ -19,6 +21,28 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set environment for branch
run: |
if [[ ${{ github.ref_name }} == 'main' ]]; then
echo "BRANCH_NAME=main" >> "$GITHUB_ENV"
echo "VALUES_FILE=prod" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'test' ]]; then
echo "BRANCH_NAME=test" >> "$GITHUB_ENV"
echo "VALUES_FILE=test" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'develop' ]]; then
echo "BRANCH_NAME=develop" >> "$GITHUB_ENV"
echo "VALUES_FILE=dev" >> "$GITHUB_ENV"
fi
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}

Expand All @@ -37,23 +61,31 @@ jobs:
- name: Docker Push to Artifactory
run: |
docker push artifacts.developer.gov.bc.ca/de27-general-docker/${{env.IMAGE_NAME}}:${GITHUB_REF##*/}
- 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
if: steps.publish.outcome == 'success'
uses: actions/checkout@v4
with:
repository: bcgov-c/tenant-gitops-e27db1
ref: develop
ref: ${{ env.BRANCH_NAME }}
token: ${{ secrets.ARGO_PAT }} # access token
path: gitops


- name: Update Helm Values and Commit
id: helm
if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful
id: helm-dev
if: github.ref == 'refs/heads/develop' && steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful
run: |
echo "Updating helm values to trigger ArgoCD deployment "
echo "Updating ${{ env.BRANCH_NAME }} helm values to trigger ArgoCD deployment"
# Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test
cd gitops/charts
Expand All @@ -62,16 +94,16 @@ jobs:
DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time
echo "Updating tag apitag: to ${{ steps.short_sha.outputs.SHORT_SHA }}"
sed -i "s/apitag: .*/apitag: dev-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" ../deploy/dev_values.yaml
sed -i "s/apitag: .*/apitag: dev-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" approvalflow/values.yaml
sed -i "s/apitag: .*/apitag: ${{ env.VALUES_FILE }}-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" ../deploy/${{ env.VALUES_FILE }}_values.yaml
sed -i "s/apitag: .*/apitag: ${{ env.VALUES_FILE }}-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" approvalflow/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
git add ../deploy/${{ env.VALUES_FILE }}_values.yaml
# Repackage Helm Chart
Expand All @@ -81,6 +113,7 @@ jobs:
git add .
git commit -m "Update Dev API image tag"
git push origin develop # Update the branch name as needed
git commit -m "Update ${{ env.BRANCH_NAME }} API image tag"
git push origin ${{ env.BRANCH_NAME }} # Update the branch name as needed
51 changes: 42 additions & 9 deletions .github/workflows/build-push-casemanagement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ name: diam-casemanagement

on:
push:
branches: [develop,test,main]
branches: [develop,test,main]
paths:
- "backend/edt.casemanagement/**"
- ".github/workflows/build-push-casemanagement.yml"
workflow_dispatch:
env:
IMAGE_NAME: diam-casemanagement
WORKING_DIRECTORY: ./backend
BRANCH_NAME: develop
VALUES_FILE: dev

jobs:
build:
Expand All @@ -18,6 +20,28 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Set environment for branch
run: |
if [[ ${{ github.ref_name }} == 'main' ]]; then
echo "BRANCH_NAME=main" >> "$GITHUB_ENV"
echo "VALUES_FILE=prod" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'test' ]]; then
echo "BRANCH_NAME=test" >> "$GITHUB_ENV"
echo "VALUES_FILE=test" >> "$GITHUB_ENV"
fi
if [[ ${{ github.ref_name }} == 'develop' ]]; then
echo "BRANCH_NAME=develop" >> "$GITHUB_ENV"
echo "VALUES_FILE=dev" >> "$GITHUB_ENV"
fi
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
Expand All @@ -38,22 +62,28 @@ jobs:
run: |
docker push artifacts.developer.gov.bc.ca/de27-general-docker/${{env.IMAGE_NAME}}:${GITHUB_REF##*/}
- 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
if: steps.publish.outcome == 'success'
uses: actions/checkout@v4
with:
repository: bcgov-c/tenant-gitops-e27db1
ref: develop
ref: ${{ env.BRANCH_NAME }}
token: ${{ secrets.ARGO_PAT }} # access token
path: gitops

- name: Update Helm Values and Commit
id: helm
if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful
if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful
run: |
echo "Updating helm values to trigger ArgoCD deployment "
echo "Updating ${{ env.VALUES_FILE }} helm values to trigger ArgoCD deployment "
# Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test
cd gitops/charts
Expand All @@ -62,16 +92,16 @@ jobs:
DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time
echo "Updating tag apitag: to ${{ steps.short_sha.outputs.SHORT_SHA }}"
sed -i "s/apitag: .*/apitag: dev-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" ../deploy/dev_values.yaml
sed -i "s/apitag: .*/apitag: dev-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" edt-casemgmt/values.yaml
sed -i "s/apitag: .*/apitag: ${{ env.VALUES_FILE }}-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" ../deploy/${{ env.VALUES_FILE }}_values.yaml
sed -i "s/apitag: .*/apitag: ${{ env.VALUES_FILE }}-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" edt-casemgmt/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
git add ../deploy/${{ env.VALUES_FILE }}_values.yaml
# Repackage Helm Chart
Expand All @@ -81,6 +111,9 @@ jobs:
git add .
git commit -m "Update Dev API image tag"
git push origin develop # Update the branch name as needed
git commit -m "Update ${{ env.BRANCH_NAME }} API image tag"
git push origin ${{ env.BRANCH_NAME }} # Update the branch name as needed
Loading

0 comments on commit b8bc264

Please sign in to comment.