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

feat!: add continuous deployment to cron package #1281

Merged
merged 5 commits into from
May 16, 2022
Merged

Conversation

flea89
Copy link
Contributor

@flea89 flea89 commented Apr 27, 2022

Resolves #1129

🚫 Before merging to main

  • Create a tag, cron-v1.0.0 to point to the latest main. This can be done on the merge commit of this PR in main?

Rationale

Cron jobs should be running on the latest "released" cron package tag.
This is achieved by checking out the latest tag in the cron workflows.

Nice To Have

The current implementation should work for existing jobs but it doesn't really prevent to have new jobs to be "missconfigured" (note checkouting latest tag).
It'd be nice to have a check in the scripts themselves, something like

cron/src/index.js

import { execSync } from 'child_process'
import { envConfig } from './lib/env.js'

export { dagCargoSizes } from './bin/dagcargo-sizes.js'
export { updatePins } from './bin/pins.js'
export { metrics } from './bin/metrics.js'

//Add new jobs here

checkOnLatestTag() {
  if(process.env.GITHUB_ACTIONS) {
   // check if on latest, if not raise
  }
}

envConfig()
checkOnLatestTag()

}

and then use run-func to run the different jobs like this:

cron/package.json

...
scripts: {
  "start:pins": "run-func src/index.js updatePins",
  ...
}

What do you think?

@flea89 flea89 force-pushed the chore/1129-cron-cd branch 2 times, most recently from 78bd09e to 0e0529e Compare April 27, 2022 14:54
@flea89 flea89 force-pushed the chore/1129-cron-cd branch 2 times, most recently from 2b1338e to 557f03a Compare May 4, 2022 13:14
@flea89
Copy link
Contributor Author

flea89 commented May 4, 2022

@alanshaw can you have a sanity check to see if this makes sense?

Copy link
Member

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

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

❤️ I love this!

@flea89 flea89 marked this pull request as ready for review May 16, 2022 15:27
@flea89 flea89 changed the title chore: add continous deployment to cron package feat!: add continuous deployment to cron package May 16, 2022
@flea89 flea89 merged commit eb79d62 into main May 16, 2022
@flea89 flea89 deleted the chore/1129-cron-cd branch May 16, 2022 15:45
@flea89
Copy link
Contributor Author

flea89 commented May 16, 2022

For context, this was discussed IRL with Alan, and we agreed this could go out without the Nice To have, given when adding a new Cron job devs generally take inspiration/copy and paste existing setup.

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.

Cron Package - Continuous Deployment
2 participants