Skip to content

Commit

Permalink
Devops test pipeline 0.2.0 (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanfandevops authored Jul 26, 2024
1 parent 130dff3 commit 0f739f4
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 5 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/devops-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Devops Test

on:
push:
branches: [ devops-test-pipeline-0.2.0 ]
workflow_dispatch:

jobs:

get-version:
name: Retrieve version
runs-on: ubuntu-latest

outputs:
output1: ${{ steps.get-version.outputs.VERSION }}

steps:
- id: get-version
run: |
version=$(echo "${{ github.event.repository.default_branch }}" | sed -E 's/release-(.*)/\1/')
echo "VERSION=$version" >> $GITHUB_OUTPUT
devops-test:

name: Devops test
runs-on: ubuntu-latest
needs: [get-version]

env:
VERSION: ${{ needs.get-version.outputs.output1 }}

steps:

- name: print version
run: |
echo "The default branch is ${{ env.VERSION }}"
29 changes: 25 additions & 4 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
- backend/**

env:
VERSION: 0.2.0
GIT_URL: https://github.com/bcgov/lcfs.git
TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools
DEV_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev
Expand All @@ -21,12 +20,30 @@ concurrency:

jobs:

get-version:
if: contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == "${{ github.event.repository.default_branch }}"
name: Retrieve version
runs-on: ubuntu-latest

outputs:
output1: ${{ steps.get-version.outputs.VERSION }}

steps:
- id: get-version
run: |
version=$(echo "${{ github.event.repository.default_branch }}" | sed -E 's/release-(.*)/\1/')
echo "VERSION=$version" >> $GITHUB_OUTPUT
build:
if: contains(github.event.pull_request.labels.*.name, 'build')
if: contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == "${{ github.event.repository.default_branch }}"
name: Build LCFS
runs-on: ubuntu-latest
needs: [get-version]
timeout-minutes: 60

env:
VERSION: ${{ needs.get-version.outputs.output1 }}

steps:

- name: Check out repository
Expand All @@ -42,6 +59,7 @@ jobs:
echo ${{ env.PR_NUMBER }}
echo ${{ env.GIT_URL }}
echo ${{ env.GIT_REF }}
echo ${{ env.VERSION }}
- name: Log in to Openshift
uses: redhat-actions/[email protected]
Expand Down Expand Up @@ -78,11 +96,14 @@ jobs:
oc tag ${{ env.TOOLS_NAMESPACE }}/lcfs-frontend:${{ env.VERSION }}-${{ env.PR_NUMBER }} ${{ env.DEV_NAMESPACE }}/lcfs-frontend:${{ env.VERSION }}-${{ env.PR_NUMBER }}
deploy:
if: contains(github.event.pull_request.labels.*.name, 'build')
if: contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == "${{ github.event.repository.default_branch }}"
name: Deploy LCFS
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [build]
needs: [get-version, build]

env:
VERSION: ${{ needs.get-version.outputs.output1 }}

steps:

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr-teardown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
types: [unlabeled]

env:
VERSION: 0.2.0
DEV_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev
PR_NUMBER: ${{ github.event.pull_request.number }}

Expand Down

0 comments on commit 0f739f4

Please sign in to comment.