Skip to content

Commit

Permalink
update pipeline title
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanfandevops committed Dec 16, 2024
1 parent 6040e1f commit 4e05ec3
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 82 deletions.
117 changes: 68 additions & 49 deletions .github/workflows/dev-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: TFRS New Pipeline Dev
name: TFRS New Pipeline Dev release-2.22.0

on:
push:
Expand All @@ -20,9 +20,37 @@ concurrency:
cancel-in-progress: true

jobs:

install-oc:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- name: Check out repository
uses: actions/[email protected]

- name: Set up cache for OpenShift CLI
id: cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc # Path where the `oc` binary will be installed
key: oc-cli-${{ runner.os }}

- name: Install OpenShift CLI (if not cached)
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc /usr/local/bin/
oc version --client
- name: Confirm OpenShift CLI is Available
run: oc version --client

get-version:
name: Get the version
runs-on: ubuntu-latest
needs: [install-oc]

outputs:
VERSION: ${{ steps.get-version.outputs.VERSION }}
Expand All @@ -47,12 +75,11 @@ jobs:
with:
ref: ${{ env.GIT_REF }}

- name: Install OpenShift CLI
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc kubectl /usr/local/bin/
oc version --client
- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
Expand Down Expand Up @@ -89,12 +116,11 @@ jobs:
with:
ref: ${{ env.GIT_REF }}

- name: Install OpenShift CLI
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc kubectl /usr/local/bin/
oc version --client
- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
Expand Down Expand Up @@ -131,12 +157,11 @@ jobs:
with:
ref: ${{ env.GIT_REF }}

- name: Install OpenShift CLI
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc kubectl /usr/local/bin/
oc version --client
- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
Expand All @@ -162,7 +187,7 @@ jobs:
name: Build TFRS Celery
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [get-version, build-backend, build-frontend, build-scan-coordinator]
needs: [build-backend, build-frontend, build-scan-coordinator]

env:
BUILD_SUFFIX: ${{ needs.get-version.outputs.VERSION }}
Expand All @@ -173,12 +198,11 @@ jobs:
with:
ref: ${{ env.GIT_REF }}

- name: Install OpenShift CLI
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc kubectl /usr/local/bin/
oc version --client
- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
Expand All @@ -204,7 +228,7 @@ jobs:
name: Build TFRS scan-handler
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [get-version, build-backend, build-frontend, build-scan-coordinator]
needs: [build-backend, build-frontend, build-scan-coordinator]

env:
BUILD_SUFFIX: ${{ needs.get-version.outputs.VERSION }}
Expand All @@ -215,12 +239,11 @@ jobs:
with:
ref: ${{ env.GIT_REF }}

- name: Install OpenShift CLI
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc kubectl /usr/local/bin/
oc version --client
- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
Expand All @@ -246,7 +269,7 @@ jobs:
name: Build TFRS Notification Server
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [get-version, build-backend, build-frontend, build-scan-coordinator]
needs: [build-backend, build-frontend, build-scan-coordinator]

env:
BUILD_SUFFIX: ${{ needs.get-version.outputs.VERSION }}
Expand All @@ -257,12 +280,11 @@ jobs:
with:
ref: ${{ env.GIT_REF }}

- name: Install OpenShift CLI
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc kubectl /usr/local/bin/
oc version --client
- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
Expand All @@ -288,10 +310,8 @@ jobs:
name: Deploy on Dev
runs-on: ubuntu-latest
timeout-minutes: 60
# needs: [get-version]
needs:
[
get-version,
build-backend,
build-frontend,
build-celery,
Expand All @@ -311,13 +331,6 @@ jobs:
repository: bcgov-c/tenant-gitops-0ab226
ref: main
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}

- name: Install OpenShift CLI
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc kubectl /usr/local/bin/
oc version --client

- name: Update tags
uses: mikefarah/[email protected]
Expand All @@ -339,6 +352,12 @@ jobs:
git commit -m "Update the image tag to ${{ env.BUILD_SUFFIX }} on Dev"
git push
- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
key: oc-cli-${{ runner.os }}

- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prod-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: TFRS New Pipeline Prod
name: TFRS New Pipeline Prod release-2.22.0

on:
workflow_dispatch:
Expand Down
64 changes: 32 additions & 32 deletions .github/workflows/test-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: TFRS New Pipeline Test
name: TFRS New Pipeline Test release-2.22.0

on:
workflow_dispatch:
Expand Down Expand Up @@ -95,27 +95,27 @@ jobs:
ref: main
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}

# - name: Update tags
# uses: mikefarah/[email protected]
# with:
# cmd: |
# yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/backend/values-test.yaml
# yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/frontend/values-test.yaml
# yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/notification-server/values-test.yaml
# yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/celery/values-test.yaml
# yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/scan-coordinator/values-test.yaml
# yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/scan-handler/values-test.yaml

# - name: GitHub Commit & Push
# shell: bash {0}
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "GitHub Actions"
# git add -A
# git commit -m "Update the image tag to ${{ env.BUILD_SUFFIX }} on Test"
# git push

- name: Restore oc command from Cßache
- name: Update tags
uses: mikefarah/[email protected]
with:
cmd: |
yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/backend/values-test.yaml
yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/frontend/values-test.yaml
yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/notification-server/values-test.yaml
yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/celery/values-test.yaml
yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/scan-coordinator/values-test.yaml
yq -i '.image.tag = "${{ env.BUILD_SUFFIX }}"' tfrs/charts/scan-handler/values-test.yaml
# - name: GitHub Commit & Push
# shell: bash {0}
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "GitHub Actions"
# git add -A
# git commit -m "Update the image tag to ${{ env.BUILD_SUFFIX }} on Test"
# git push

- name: Restore oc command from Cache
uses: actions/[email protected]
with:
path: /usr/local/bin/oc
Expand All @@ -129,23 +129,23 @@ jobs:
insecure_skip_tls_verify: true
namespace: ${{ env.TOOLS_NAMESPACE }}

- name: Tag and deploy to Test
run: |
helm -n ${{ env.TEST_NAMESPACE }} list
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-backend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-backend:${{ env.BUILD_SUFFIX }}
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-frontend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-frontend:${{ env.BUILD_SUFFIX }}
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-celery:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-celery:${{ env.BUILD_SUFFIX }}
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-scan-coordinator:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-scan-coordinator:${{ env.BUILD_SUFFIX }}
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-scan-handler:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-scan-handler:${{ env.BUILD_SUFFIX }}
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-notification-server:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-notification-server:${{ env.BUILD_SUFFIX }}
# - name: Tag and deploy to Test
# run: |
# helm -n ${{ env.TEST_NAMESPACE }} list
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-backend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-backend:${{ env.BUILD_SUFFIX }}
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-frontend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-frontend:${{ env.BUILD_SUFFIX }}
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-celery:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-celery:${{ env.BUILD_SUFFIX }}
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-scan-coordinator:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-scan-coordinator:${{ env.BUILD_SUFFIX }}
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-scan-handler:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-scan-handler:${{ env.BUILD_SUFFIX }}
# oc tag ${{ env.DEV_NAMESPACE }}/tfrs-notification-server:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/tfrs-notification-server:${{ env.BUILD_SUFFIX }}

- name: Ask for approval for TFRS Test deployment
uses: trstringer/[email protected]
with:
secret: ${{ github.TOKEN }}
approvers: AlexZorkin,kuanfandevops,prv-proton,JulianForeman,kevin-hashimoto,dhaselhan
minimum-approvals: 1
issue-title: "TFRS ${{ env.GIT_REF }} Test Deployment at $(date '+%Y-%m-%d %H:%M:%S %Z')"
issue-title: eval ("TFRS ${{ env.GIT_REF }} Test Deployment at " + $(date '+%Y-%m-%d %H:%M:%S %Z') )

# - name: Helm Deployment
# run: |
Expand Down

0 comments on commit 4e05ec3

Please sign in to comment.