Skip to content

ci: deploy automatic PR deployments on request #8121

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 106 commits into from
Jun 22, 2023
Merged

Conversation

matifali
Copy link
Member

@matifali matifali commented Jun 21, 2023

This will allow us to have PR deployments on our OpenStack k8s cluster.
resolves #7889

How to use

To create a new PR deployment any org member can comment /deploy-pr on the pull request. A new deployment can be re-triggered by commenting /deploy-pr again or manually invoking the workflow with,

gh workflow run "Deploy PR" -f pr_number=PR_NUMBER

How this works

  1. Build an amd64 Linux docker image
  2. Push the image to ghcr.io/coder/coder-preview:PR_NUMBER
  3. Deploy to a dedicated namespace pr${{PR_NUMBER}} on k8s cluster hosted at OpenStack
  4. Send a Slack notification in the #pr-deployments channel with the deployment URL
  5. Comment on the PR with the link to the slack channel and deployment status.
  6. Cleans up the image from the registry, helm deployment, and namespace when PR is closed or merged

@matifali matifali marked this pull request as draft June 21, 2023 08:20
@matifali matifali changed the title ci: pr deployments ci: deploy automatic PR deployments on request Jun 22, 2023
@matifali matifali requested a review from bpmct June 22, 2023 08:52
Copy link
Member

@bpmct bpmct left a comment

Choose a reason for hiding this comment

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

LGTM. I had two ideas, but feel free to do them after merge if this is too difficult:

  1. Link to the Slack channel when it is deployed so that someone can fetch the access URL
  2. When the PR is closed, have the Slack bot reply to the thread to say that the deployment has been removed.

@matifali
Copy link
Member Author

matifali commented Jun 22, 2023

LGTM. I had two ideas, but feel free to do them after merge if this is too difficult:

  1. Link to the Slack channel when it is deployed so that someone can fetch the access URL
  2. When the PR is closed, have the Slack bot reply to the thread to say that the deployment has been removed.

@bpmct if I understand correctly, 1 is already done? We get a notification whenever there is a new deployment.
Do you want me to put the link in the comment? Done.

I will do 2 separately from this PR.

@matifali matifali enabled auto-merge (squash) June 22, 2023 14:25
@matifali matifali merged commit 1ffc805 into main Jun 22, 2023
@matifali matifali deleted the matifali/pr-deploymnets branch June 22, 2023 14:36
@github-actions github-actions bot locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ci: PR deployments
2 participants