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

Create a Comment Command That Redeploys the Current Commit #173

Closed
CodeGat opened this issue Nov 22, 2024 · 2 comments · Fixed by #176
Closed

Create a Comment Command That Redeploys the Current Commit #173

CodeGat opened this issue Nov 22, 2024 · 2 comments · Fixed by #176
Assignees
Labels
priority:medium type:feature New feature version:MAJOR Requires an update to Model Deployment Repositories CI

Comments

@CodeGat
Copy link
Member

CodeGat commented Nov 22, 2024

Background

A common use case seems to be requiring a rebuild of the HEAD Prerelease when a model component using a @git.BRANCH reference is updated. The @git.BRANCH reference is better than using a @git.TAG/@git.COMMIT reference, as the others would either require adding a temporary tag, or copying the commit hash. It's also preferable to adding a comment to the spack.yaml noting the update, because that is an update that would need to be updated.

Add a comment command that redeploys the current HEAD.

Note

As with other ChatOps methods, this will not prevent/allow merging, unless there is a way to append checks to a given commit. Specifically, if one redeployed with a model component change that broke the model, it would still be allowed to merge. Although, https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#create-a-commit-status looks good... This is not the case anymore, adding checks from non-PR sources works fine, so we can prevent merging with myrotvorets/set-commit-status-action.

Workaround

  • Add an empty commit, in which the message can note what was changed: git commit --allow-empty -m "Redeploying to test out new component changes"
  • Comment in the spack.yaml the hash used in the components @git.BRANCH HEAD
  • Use the @git.TAG reference
@CodeGat
Copy link
Member Author

CodeGat commented Nov 29, 2024

At the moment, I've been testing in ACCESS-NRI/ACCESS-TEST#7. It's not currently working: ACCESS-NRI/ACCESS-TEST#7 (comment)

One of the issues is the incrementing of deployment numbers - on.issue_comment considers the deployment to be on the main branch, and so our incrementing counter based on gh api /repos/access-nri/access-test/deployments --jq '[.[] | select(.ref == "$PR_BRANCH")] | length + 1' doesn't work.

We'll either have to find a different part of the deployment to hinge on instead of .ref, or find a way to associate a deployment event with the pull request, again.

@CodeGat
Copy link
Member Author

CodeGat commented Dec 4, 2024

Fixed it! And the deployment hinges on deployments on the PR branch + "!redeploy" comments on the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:medium type:feature New feature version:MAJOR Requires an update to Model Deployment Repositories CI
Projects
Status: Done ✅
Development

Successfully merging a pull request may close this issue.

1 participant