Skip to content

Conversation

@andrewsignori-aot
Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot commented Jun 2, 2023

  • Reorganized the workflows names with the intention to have them grouped in the UI as Env Setup, Release, and Repo Checks.
    • Env Setup - Build and Deploy Forms Server
    • Env Setup - Deploy SIMS Secrets to Openshift
    • Release - Build All
    • Release - Create Branch
    • Release - Deploy Camunda Resources
    • Release - Deploy Form.io resources
    • Repo Checks - Tests
  • The "build" section from .github/workflows/release-build-all.yml was not changed. The apps are building as they were before.
  • The semantic version to add the build using the "+" is not valid to be used as the Openshift image name and the "-" was used instead, so, instead of v1.0.0+123 we will have v1.0.0-123. The idea is still to keep a clear separation between the semantic version part and the build part. Thoughts?
  • Created the Release - Create Branch to start new release/hotfix cycles, as shown in the below image.
  • Changed the build process to accommodate also the below image flow.

image

@andrewsignori-aot andrewsignori-aot self-assigned this Jun 2, 2023
@andrewsignori-aot andrewsignori-aot added the Devops Devops label Jun 2, 2023
@ann-aot
Copy link
Contributor

ann-aot commented Jun 5, 2023

  • The semantic version to add the build using the "+" is not valid to be used as the Openshift image name and the "-" was used instead, so, instead of v1.0.0+123 we will have v1.0.0-123. The idea is still to keep a clear separation between the semantic version part and the build part. Thoughts?

I am good with - approach 👍

# Deploy all applications to DEV when there is a pull request on the main branch.
# If DEV is used to deploy a release or hotfix branch the automatic deploy can be stopped using the env variable because there
# is a potencial to main/relase/hotfix branches have differences (for instance o DB) that would not be backward compatible.
Copy link
Contributor

Choose a reason for hiding this comment

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

(for instance o DB) ?

Copy link
Collaborator Author

@andrewsignori-aot andrewsignori-aot Jun 5, 2023

Choose a reason for hiding this comment

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

"o" is the equivalent of "the" in Portuguese 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed!

# If DEV is used to deploy a release or hotfix branch the automatic deploy can be stopped using the env variable because there
# is a potencial to main/relase/hotfix branches have differences (for instance o DB) that would not be backward compatible.
deployAll:
if: github.event_name == 'pull_request' && vars.ALLOW_AUTOMATIC_MAIN_BRANCH_DEPLOY_TO_DEV == 'true' && github.ref_name == 'main'
Copy link
Contributor

Choose a reason for hiding this comment

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

mm, does github.ref_name == 'main' logic make sure that the PR on main branch?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

main will be the branch name that triggered the workflow, so I believe that it is a safe way.

Copy link
Contributor

Choose a reason for hiding this comment

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

ya...so, according to the comment, how does the workflow know that the PR was on the main branch not on the release or hotfix branch? is it with ALLOW_AUTOMATIC_MAIN_BRANCH_DEPLOY_TO_DEV? Maybe I am missing something

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes @ann-aot you are right, the github.ref_name == 'main' logic make sure that the deployAll job (deployment) will run only when the workflow is triggered from main branch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ann-aot my comment had the link to the documentation on Github that explains the github.ref_name.
To be clear, this is the link: https://docs.github.com/en/actions/learn-github-actions/contexts
This is the documentation.
image

Please let me know if there is any further question.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. Thanks for explaining @guru-aot and @andrewsignori-aot

versionName:
description: "Version name (must follow e.g. v1.0.0)"
required: true
default: "v0.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need a default value here?

Copy link
Collaborator Author

@andrewsignori-aot andrewsignori-aot Jun 6, 2023

Choose a reason for hiding this comment

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

Nope, but I thought that it would be good to lead the user to exactly what we expected.

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

LGTM. some minor comments added

workflow_dispatch:

env:
BUILD_NAMESPACE: 0c27fb-tools
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a part of this PR. Namespace could be a non-secret env from github?

Copy link
Collaborator Author

@andrewsignori-aot andrewsignori-aot Jun 6, 2023

Choose a reason for hiding this comment

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

I liked the idea, I will do it in an upcoming PR.

ref: ${{ needs.createTag.outputs.newTag }}
- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I liked the idea, I will do it in an upcoming PR.

# If DEV is used to deploy a release or hotfix branch the automatic deploy can be stopped using the env variable because there
# is a potencial to main/relase/hotfix branches have differences (for instance o DB) that would not be backward compatible.
deployAll:
if: github.event_name == 'pull_request' && vars.ALLOW_AUTOMATIC_MAIN_BRANCH_DEPLOY_TO_DEV == 'true' && github.ref_name == 'main'
Copy link
Collaborator

Choose a reason for hiding this comment

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

vars.ALLOW_AUTOMATIC_MAIN_BRANCH_DEPLOY_TO_DEV == 'true' 👍

required: true
type: string
secrets:
SA_TOKEN:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This ensures that the required secrets and in place before the workflow starts right? I meant if any of these secrets are missing then it will fail upfront?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is the idea. It also does not work if they are not present. I will be able to test it once it is merged into the main.

@dheepak-aot
Copy link
Collaborator

Great work and thanks for walk through. Just a few minor comments.

@sh16011993
Copy link
Collaborator

Thank You for the walkthrough. LGTM 👍

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@github-actions
Copy link

github-actions bot commented Jun 6, 2023

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 17.91% ( 2091 / 11672 )
Methods: 8.23% ( 123 / 1494 )
Lines: 20.69% ( 1832 / 8853 )
Branches: 10.26% ( 136 / 1325 )

@github-actions
Copy link

github-actions bot commented Jun 6, 2023

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 49.81% ( 267 / 536 )
Methods: 41.56% ( 32 / 77 )
Lines: 55.33% ( 218 / 394 )
Branches: 26.15% ( 17 / 65 )

@github-actions
Copy link

github-actions bot commented Jun 6, 2023

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 69.4% ( 390 / 562 )
Methods: 59.15% ( 42 / 71 )
Lines: 71.52% ( 344 / 481 )
Branches: 40% ( 4 / 10 )

@github-actions
Copy link

github-actions bot commented Jun 6, 2023

E2E SIMS API Coverage Report

Totals Coverage
Statements: 43.53% ( 3040 / 6984 )
Methods: 37.65% ( 340 / 903 )
Lines: 48.6% ( 2533 / 5212 )
Branches: 19.22% ( 167 / 869 )

Copy link
Collaborator

@sh16011993 sh16011993 left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thank You for the code walkthrough

@@ -1,4 +1,4 @@
name: Build and Deploy Formio Server.
name: Env Setup - Build and Deploy Forms Server
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@@ -1,4 +1,4 @@
name: Deploy SIMS secrets to Openshift
name: Env Setup - Deploy SIMS Secrets to Openshift
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@@ -0,0 +1,199 @@
name: Release - Build All
Copy link
Contributor

Choose a reason for hiding this comment

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

As this has the deployAll to main branch, can we please change the name to Build All / and Deploy to Dev. Also if possible please change the deployAll name to deployDev.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see the point, but the intention of the script is to build, the "deploy" part is just to keep to the current behavior of building and deploying for the main branch to ensure that it is "deployable". As we talked I would prefer to keep the name as it is for now.

# Deploy all applications to DEV when there is a pull request on the main branch.
# If DEV is used to deploy a release or hotfix branch the automatic deploy can be stopped using the env variable because there
# is a Potential to main/relase/hotfix branches have differences (for instance the DB) that would not be backward compatible.
deployAll:
Copy link
Contributor

@guru-aot guru-aot Jun 6, 2023

Choose a reason for hiding this comment

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

https://github.com/bcgov/SIMS/pull/1986/files#r1219983294, Please change the job name to deployDev

deployFormioDefinitions:
required: true
type: string
secrets:
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

name: Deploy All to DEV
needs:
[
createTag,
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove createTag as its a need in build-db-migrations

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried to remove and then I remember that we need it to be able to consume the tag name.
gitRef: ${{ needs.createTag.outputs.newTag }}

Copy link
Contributor

Choose a reason for hiding this comment

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

nice catch 👍

Copy link
Contributor

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

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

Nice work @andrewsignori-aot, please have a look on the comments.

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Thanks for the walkthrough

Copy link
Collaborator

@dheepak-aot dheepak-aot left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for making the changes.

Copy link
Contributor

@andrepestana-aot andrepestana-aot left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

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

LGTM, nice work @andrewsignori-aot

@andrewsignori-aot andrewsignori-aot merged commit 756a430 into main Jun 6, 2023
@andrewsignori-aot andrewsignori-aot deleted the release-workflows-1917 branch June 7, 2023 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Devops Devops

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants