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

Cron job to start rebuild everything pipelines #845

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kwryankrattiger
Copy link
Collaborator

Cron job that starts rebuild everything on a new branch dedicated to rebuilding everything. The branch gets tagged with a date stamp for tracking purposes.

I think we can add these to the list of pruning activities we do with snapshot pruning.

Pre-requisite spack CI change, spack/spack#44200

cc: @scottwittenburg

Copy link
Collaborator

@scottwittenburg scottwittenburg left a comment

Choose a reason for hiding this comment

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

Thanks for taking a stab at this @kwryankrattiger! Just curious if you saw the similar thing @zackgalbreath did here, which does much the same, but seems a little simpler. I know in this case you're pushing directly to gitlab, so you'd have to verify whether a similar api is available in the python-gitlab package.



@contextmanager
def chworkingdir(path):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you look at the one provided by contextlib? Maybe you don't need to write your own.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It would have to be something like with tempdir.TemporaryDirectory() as workingdir, contextmanager.chdir(workingdir) which I didn't like. The one I have lets be choose whether to chdir to a temp dir or a persistent dir which was nice to test this locally.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I did the something similar for testing protected publish locally, this is how I avoided forcing use of a temporary directory.

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 way yield works is still a bit of magic to me, I didn't know I could construct it, return the yielded result, and use it in a with clause. 🪄

setup_repo(args.pull_remote, args.push_remote, args.pull_branch)

if args.tag:
subprocess.run(["git", "tag", args.push_branch], check=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you may need an annotated tag object. I feel like Zack ran into something like that when pushing the develop snapshot tags.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is here for potentially changing this to tag develop and push the new tag on the currently running develop, or push a new develop. I am not sure what is better.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I know what you mean. I'm was just wondering if the git tag needed a -a.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh, this isn't for a release or anything so I don't think there is a need to add any annotations. These also only get pushed to gitlab, so they are opaque to the world.

@kwryankrattiger
Copy link
Collaborator Author

I decided not to use the API because I wanted to try pushing the latest develop on github and it seemed simpler to me to just use git commands directly. I was back and forth on making this a bash script, but it was easier to just use some of the existing bits from gh-gl-sync. That is where I got the repo setup for spackbot running and the ssh key registration.

@kwryankrattiger
Copy link
Collaborator Author

Just curious if you saw the similar thing @zackgalbreath did here,

I didn't see that, but I used the gitlab API for the pruner. I didn't for this because I didn't need the pagination or API requests and this works no matter where the remotes are located since it just takes source, dest, from branch, to branch/tag. Not direct deps on gh or gl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants