Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devops test pipeline 0.2.0 #784

Merged
merged 7 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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