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

Fixed CI/CD #16

Merged
merged 1 commit into from
Dec 4, 2023
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# review when someone opens a pull request.

- @Fosol
- @Fosol @wkaspryk
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will, you should now get emails when a PR is created.


# Order is important; the last matching pattern takes the most

Expand Down
32 changes: 28 additions & 4 deletions .github/workflows/ci-cd-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ on:
# branches:
# - dev
# - main
# - test

jobs:
build-push:
name: Build and Push to Registry
runs-on: ubuntu-latest
outputs:
api: ${{ steps.filter.outputs.api }}
dashboard: ${{ steps.filter.outputs.dashboard }}
db-migration: ${{ steps.filter.outputs.db-migration }}
timeout-minutes: 10
permissions:
contents: read
Expand All @@ -46,12 +51,26 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: filter
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditions to control which steps are run.

api:
- 'src/api/**'
- 'src/libs/**'
dashboard:
- 'src/dashboard/**'
db-migration:
- 'src/libs/dal/**'

## BUILD
- name: Build API
id: build-api
uses: redhat-actions/buildah-build@v2
if: steps.filter.outputs.api == 'true'
with:
image: ${{ github.repository }}/${{ env.API_IMAGE_NAME }}
image: ${{ github.event.repository.name }}/${{ env.API_IMAGE_NAME }}
tags: ${{ env.IMAGE_TAG }} ${{ env.VERSION }} ${{ env.DEPLOY_TO }}
context: .
dockerfiles: |
Expand All @@ -60,8 +79,9 @@ jobs:
- name: Build Dasbhoard
id: build-app
uses: redhat-actions/buildah-build@v2
if: steps.filter.outputs.dashboard == 'true'
with:
image: ${{ github.repository }}/${{ env.APP_IMAGE_NAME }}
image: ${{ github.event.repository.name }}/${{ env.APP_IMAGE_NAME }}
tags: ${{ env.IMAGE_TAG }} ${{ env.VERSION }} ${{ env.DEPLOY_TO }}
context: src/dashboard
dockerfiles: |
Expand All @@ -70,8 +90,9 @@ jobs:
- name: Build DB Migration
id: build-db-migration
uses: redhat-actions/buildah-build@v2
if: steps.filter.outputs.db-migration == 'true'
with:
image: ${{ github.repository }}/${{ env.DB_MIGRATION_IMAGE_NAME }}
image: ${{ github.event.repository.name }}/${{ env.DB_MIGRATION_IMAGE_NAME }}
tags: ${{ env.IMAGE_TAG }} ${{ env.VERSION }} ${{ env.DEPLOY_TO }}
context: src/libs
dockerfiles: |
Expand All @@ -80,15 +101,17 @@ jobs:
## PUSH TO REGISTRY
- name: Push API to registry
uses: redhat-actions/push-to-registry@v2
if: steps.filter.outputs.api == 'true'
with:
image: ${{ github.repository }}/${{ env.DB_MIGRATION_IMAGE_NAME }}
image: ${{ steps.build-api.outputs.image }}
tags: ${{ steps.build-api.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}

- name: Push Dashboard to registry
uses: redhat-actions/push-to-registry@v2
if: steps.filter.outputs.dashboard == 'true'
with:
image: ${{ steps.build-app.outputs.image }}
tags: ${{ steps.build-app.outputs.tags }}
Expand All @@ -98,6 +121,7 @@ jobs:

- name: Push DB Migration to registry
uses: redhat-actions/push-to-registry@v2
if: steps.filter.outputs.db-migration == 'true'
with:
image: ${{ steps.build-db-migration.outputs.image }}
tags: ${{ steps.build-db-migration.outputs.tags }}
Expand Down
25 changes: 23 additions & 2 deletions devops/kustomize/base/tekton/imageStreams/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,34 @@ spec:
lookupPolicy:
local: false
tags:
- name: dev
annotations: null
from:
kind: DockerImage
name: >-
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/hsb-dashboard/api:dev
importPolicy:
scheduled: true
importMode: Legacy
referencePolicy:
type: Source
- name: latest
annotations: null
from:
kind: DockerImage
name: >-
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/bcgov/hsb-dashboard/api:latest
generation: 1
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/hsb-dashboard/api:latest
importPolicy:
scheduled: true
importMode: Legacy
referencePolicy:
type: Source
- name: test
annotations: null
from:
kind: DockerImage
name: >-
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/hsb-dashboard/api:test
importPolicy:
scheduled: true
importMode: Legacy
Expand Down
25 changes: 23 additions & 2 deletions devops/kustomize/base/tekton/imageStreams/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,34 @@ spec:
lookupPolicy:
local: false
tags:
- name: dev
annotations: null
from:
kind: DockerImage
name: >-
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/hsb-dashboard/dashboard:dev
importPolicy:
scheduled: true
importMode: Legacy
referencePolicy:
type: Source
- name: latest
annotations: null
from:
kind: DockerImage
name: >-
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/bcgov/hsb-dashboard/dashboard:latest
generation: 1
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/hsb-dashboard/dashboard:latest
importPolicy:
scheduled: true
importMode: Legacy
referencePolicy:
type: Source
- name: test
annotations: null
from:
kind: DockerImage
name: >-
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/hsb-dashboard/dashboard:test
importPolicy:
scheduled: true
importMode: Legacy
Expand Down
25 changes: 23 additions & 2 deletions devops/kustomize/base/tekton/imageStreams/db-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,34 @@ spec:
lookupPolicy:
local: false
tags:
- name: dev
annotations: null
from:
kind: DockerImage
name: >-
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/hsb-dashboard/db-migration:dev
importPolicy:
scheduled: true
importMode: Legacy
referencePolicy:
type: Source
- name: latest
annotations: null
from:
kind: DockerImage
name: >-
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/bcgov/hsb-dashboard/db-migration:latest
generation: 1
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/hsb-dashboard/db-migration:latest
importPolicy:
scheduled: true
importMode: Legacy
referencePolicy:
type: Source
- name: test
annotations: null
from:
kind: DockerImage
name: >-
artifacts.developer.gov.bc.ca/github-docker-remote/bcgov/hsb-dashboard/db-migration:test
importPolicy:
scheduled: true
importMode: Legacy
Expand Down
8 changes: 6 additions & 2 deletions do
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ elif [ "$action" = "db-redo" ]; then
# Openshift
elif [ "$action" = "db-connect" ]; then
db-connect ${2-prod} ${3-} ${4-}
elif [ "$action" = "deploy" ]; then
deploy ${2-} ${3-} ${4-}
elif [ "$action" = "oc-build" ]; then
oc-build ${2-} ${3-}
elif [ "$action" = "oc-push" ]; then
oc-push ${2-} ${3-}
elif [ "$action" = "oc-deploy" ]; then
oc-deploy ${2-} ${3-} ${4-} ${5-}

# NPM
elif [ "$action" = "npm-install" ]; then
Expand Down
Loading
Loading