Skip to content

First draft of CD workflow #108

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

Merged
merged 9 commits into from
May 1, 2025
Merged

First draft of CD workflow #108

merged 9 commits into from
May 1, 2025

Conversation

cc-a
Copy link
Collaborator

@cc-a cc-a commented Jan 22, 2025

A deployment pipeline intended for use with the Beta launch:

Features:

  • The deployment workflow is run on pushes to develop and main. In order to pass the sha of the published docker image the deployment is run is called from the publish workflow with the image tag being passed as an input argument.
  • The deployment workflow may also be triggered manually in order to support manual redeployment and disaster recovery scenarios. In this case the image tag is provided when the workflow is triggered.
  • The docker image is provided via sha to ensure that the relevant Kubernetes deployments are updated with the new image.
  • The same workflow is run for both the develop and main branches but different values are provided for the secrets and environment variables via Github Actions environments. For manual deployments the environment is provided as an input value.
  • The ref of the commit to use for the Helm chart is set via environment variable to allow controlled updates of the helm chart being used in testing/production.

Developer Checklist

Developers should review and confirm each of these items before requesting review

  • Code meets acceptance criteria from issue
  • Unit tests are written and all pass
  • User Test Scripts (if required) are written and have been run through
  • Code documentation and related non-code documentation has all been updated

Reviewer Checklist

Reviewers should review and confirm each of these items before approval
If there are multiple reviewers, this section can be duplicated for each reviewer

  • Code meets acceptance criteria from issue
  • Unit tests are written and all pass
  • User Test Scripts (if required) are written and have been run through
  • Code documentation and related non-code documentation has all been updated
  • Migation has been created and tested

Testing

List user test scripts that need to be run

List any non-unit test scripts that need to be run

@cc-a cc-a marked this pull request as draft January 22, 2025 14:14
@cc-a cc-a force-pushed the feature/actions_deploy branch from d9abc71 to d7b02d2 Compare March 27, 2025 18:00
@cc-a cc-a force-pushed the feature/actions_deploy branch from d7b02d2 to 4ee95ec Compare March 27, 2025 18:02
@cc-a cc-a force-pushed the feature/actions_deploy branch from 4ee95ec to 6b2736b Compare March 27, 2025 18:08
@cc-a cc-a force-pushed the feature/actions_deploy branch from 6b2736b to 3f1502d Compare March 27, 2025 20:44
@cc-a cc-a force-pushed the feature/actions_deploy branch from 3f1502d to db82446 Compare March 27, 2025 20:51
@cc-a cc-a force-pushed the feature/actions_deploy branch from db82446 to dd21b1a Compare March 28, 2025 09:44
@cc-a cc-a force-pushed the feature/actions_deploy branch from dd21b1a to effbe70 Compare March 28, 2025 10:49
@cc-a cc-a force-pushed the feature/actions_deploy branch from effbe70 to d17633b Compare March 28, 2025 10:52
@cc-a cc-a force-pushed the feature/actions_deploy branch from d17633b to 7fd059b Compare March 28, 2025 10:57
Copy link
Collaborator

@Steven-Eardley Steven-Eardley left a comment

Choose a reason for hiding this comment

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

These latest changes make sense to me - we're using the raw helm command so it's acting equivalently to our dev environments

@Steven-Eardley Steven-Eardley marked this pull request as ready for review April 1, 2025 11:41
@cc-a cc-a requested review from alexdewar, Sahil590 and Copilot April 8, 2025 11:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Copy link
Contributor

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

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

Seems sensible. Is the plan to use helm for development as well as production eventually?

Comment on lines 57 to 78
-f ${{ vars.CHART_OVERRIDE_PATH }} \
-n invenio --install --create-namespace \
--set invenio.secret_key="${{ secrets.INVENIO_SECRET_KEY }}" \
--set invenio.security_login_salt="${{ secrets.INVENIO_SECURITY_LOGIN_SALT }}" \
--set invenio.csrf_secret_salt="${{ secrets.INVENIO_CSRF_SECRET_SALT }}" \
--set invenio.extraConfig.ICL_OAUTH_CLIENT_ID=${{ vars.ICL_OAUTH_CLIENT_ID }} \
--set invenio.extraConfig.ICL_OAUTH_CLIENT_SECRET="${{ secrets.ICL_OAUTH_CLIENT_SECRET }}" \
--set invenio.extraConfig.ICL_OAUTH_WELL_KNOWN_URL=${{ vars.ICL_OAUTH_WELL_KNOWN_URL }} \
--set rabbitmq.auth.password="${{ secrets.RABBITMQ_AUTH_PASSWORD }}" \
--set postgresql.auth.password="${{ secrets.POSTGRESQL_AUTH_PASSWORD }}" \
--set invenio.hostname=${{ vars.HOSTNAME }} \
--set web.image=${{ inputs.image_tag_with_sha }} \
--set worker.image=${{ inputs.image_tag_with_sha }} \
--set invenio.datacite.password="${{ secrets.DATACITE_PASSWORD }}" \
--set invenio.datacite.username=${{ vars.DATACITE_USERNAME }} \
--set invenio.extraConfig.INVENIO_DATACITE_PREFIX=${{ vars.DATACITE_PREFIX }} \
--set-string invenio.extraConfig.INVENIO_DATACITE_TEST_MODE=True \
--set invenio.extraConfig.INVENIO_MAIL_USERNAME=${{ vars.EMAIL_USERNAME }} \
--set invenio.extraConfig.INVENIO_MAIL_PASSWORD="${{ secrets.MAIL_PASSWORD }}" \
--set persistence.size=${{ vars.FILES_STORAGE_SIZE }} \
--set-string invenio.extraConfig.INVENIO_MAIL_USE_TLS=True \
--set-string invenio.extraConfig.INVENIO_MAIL_DEFAULT_SENDER=${{ vars.EMAIL_USERNAME }}
Copy link
Contributor

Choose a reason for hiding this comment

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

How about some more indentation for readability:

Suggested change
-f ${{ vars.CHART_OVERRIDE_PATH }} \
-n invenio --install --create-namespace \
--set invenio.secret_key="${{ secrets.INVENIO_SECRET_KEY }}" \
--set invenio.security_login_salt="${{ secrets.INVENIO_SECURITY_LOGIN_SALT }}" \
--set invenio.csrf_secret_salt="${{ secrets.INVENIO_CSRF_SECRET_SALT }}" \
--set invenio.extraConfig.ICL_OAUTH_CLIENT_ID=${{ vars.ICL_OAUTH_CLIENT_ID }} \
--set invenio.extraConfig.ICL_OAUTH_CLIENT_SECRET="${{ secrets.ICL_OAUTH_CLIENT_SECRET }}" \
--set invenio.extraConfig.ICL_OAUTH_WELL_KNOWN_URL=${{ vars.ICL_OAUTH_WELL_KNOWN_URL }} \
--set rabbitmq.auth.password="${{ secrets.RABBITMQ_AUTH_PASSWORD }}" \
--set postgresql.auth.password="${{ secrets.POSTGRESQL_AUTH_PASSWORD }}" \
--set invenio.hostname=${{ vars.HOSTNAME }} \
--set web.image=${{ inputs.image_tag_with_sha }} \
--set worker.image=${{ inputs.image_tag_with_sha }} \
--set invenio.datacite.password="${{ secrets.DATACITE_PASSWORD }}" \
--set invenio.datacite.username=${{ vars.DATACITE_USERNAME }} \
--set invenio.extraConfig.INVENIO_DATACITE_PREFIX=${{ vars.DATACITE_PREFIX }} \
--set-string invenio.extraConfig.INVENIO_DATACITE_TEST_MODE=True \
--set invenio.extraConfig.INVENIO_MAIL_USERNAME=${{ vars.EMAIL_USERNAME }} \
--set invenio.extraConfig.INVENIO_MAIL_PASSWORD="${{ secrets.MAIL_PASSWORD }}" \
--set persistence.size=${{ vars.FILES_STORAGE_SIZE }} \
--set-string invenio.extraConfig.INVENIO_MAIL_USE_TLS=True \
--set-string invenio.extraConfig.INVENIO_MAIL_DEFAULT_SENDER=${{ vars.EMAIL_USERNAME }}
-f ${{ vars.CHART_OVERRIDE_PATH }} \
-n invenio --install --create-namespace \
--set invenio.secret_key="${{ secrets.INVENIO_SECRET_KEY }}" \
--set invenio.security_login_salt="${{ secrets.INVENIO_SECURITY_LOGIN_SALT }}" \
--set invenio.csrf_secret_salt="${{ secrets.INVENIO_CSRF_SECRET_SALT }}" \
--set invenio.extraConfig.ICL_OAUTH_CLIENT_ID=${{ vars.ICL_OAUTH_CLIENT_ID }} \
--set invenio.extraConfig.ICL_OAUTH_CLIENT_SECRET="${{ secrets.ICL_OAUTH_CLIENT_SECRET }}" \
--set invenio.extraConfig.ICL_OAUTH_WELL_KNOWN_URL=${{ vars.ICL_OAUTH_WELL_KNOWN_URL }} \
--set rabbitmq.auth.password="${{ secrets.RABBITMQ_AUTH_PASSWORD }}" \
--set postgresql.auth.password="${{ secrets.POSTGRESQL_AUTH_PASSWORD }}" \
--set invenio.hostname=${{ vars.HOSTNAME }} \
--set web.image=${{ inputs.image_tag_with_sha }} \
--set worker.image=${{ inputs.image_tag_with_sha }} \
--set invenio.datacite.password="${{ secrets.DATACITE_PASSWORD }}" \
--set invenio.datacite.username=${{ vars.DATACITE_USERNAME }} \
--set invenio.extraConfig.INVENIO_DATACITE_PREFIX=${{ vars.DATACITE_PREFIX }} \
--set-string invenio.extraConfig.INVENIO_DATACITE_TEST_MODE=True \
--set invenio.extraConfig.INVENIO_MAIL_USERNAME=${{ vars.EMAIL_USERNAME }} \
--set invenio.extraConfig.INVENIO_MAIL_PASSWORD="${{ secrets.MAIL_PASSWORD }}" \
--set persistence.size=${{ vars.FILES_STORAGE_SIZE }} \
--set-string invenio.extraConfig.INVENIO_MAIL_USE_TLS=True \
--set-string invenio.extraConfig.INVENIO_MAIL_DEFAULT_SENDER=${{ vars.EMAIL_USERNAME }}

@@ -8,7 +8,7 @@ jobs:
qa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking dependabot normally does these... but it seems we don't actually have dependabot enabled for this repo. Do we want to add it?

@cc-a cc-a linked an issue Apr 10, 2025 that may be closed by this pull request
@cc-a cc-a force-pushed the feature/actions_deploy branch from 8aeedc0 to d2bafb6 Compare April 15, 2025 14:43
@cc-a
Copy link
Collaborator Author

cc-a commented Apr 28, 2025

Would be great if you could take a look when you get the chance @Steven-Eardley

--set persistence.size=${{ vars.FILES_STORAGE_SIZE }} \
--set-string invenio.extraConfig.INVENIO_MAIL_USE_TLS=True \
--set-string invenio.extraConfig.INVENIO_MAIL_DEFAULT_SENDER=${{ vars.EMAIL_USERNAME }} \
--set worker.resources.requests.cpu=${{ vars.WORKER_REQUESTS_CPU }} \
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand this is what Trevor asked for - my approach would probably be to set these in the values.override and not necessarily bring them all the way out to helm upgrade just because of the verbosity of this approach. But since it was a request, let's carry on

@@ -9,6 +9,8 @@ on:
jobs:
build-and-publish:
runs-on: ubuntu-latest
outputs:
image_tag_with_sha: ${{ steps.export-data.outputs.image_tag_with_sha }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

handy for a proper rolling upgrade

@cc-a cc-a force-pushed the feature/actions_deploy branch from 9aa2293 to 8628a8d Compare May 1, 2025 16:35
@cc-a cc-a merged commit 511c56d into develop May 1, 2025
3 checks passed
@cc-a cc-a deleted the feature/actions_deploy branch May 1, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

CI/CD pipeline for automated deployment
3 participants