-
Notifications
You must be signed in to change notification settings - Fork 2
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
Continuous Delivery for H9 #107
Comments
We could watch the |
Why watch a file at all? Why not just have a release branch? |
We can have a release branch, but putting on my CD hat, Why watch a file? Because our npm and Docker Hub deployments are versioned. And a human being makes the semver decision re: "backwards-compatible change". So the simplest pattern I could think of is have a human being update the |
…more re: watching a Basically we need some way to track state of "what version is deployed to npm and docker hub?" versus "what is the latest version?", in order to prevent our CD process from overwriting I foresee this happening often enough to be frustrating, given that the |
Stealing a pattern from Disney: replaced the notion of watching a |
What is the workflow when using a Git tag as a trigger? Won't that cause us to have tags that don't match the version in package.json? |
Now we have a tagged commit in the repo where the version in package.json is behind. |
Yup. All these still have the same basic problem where everything gets out of sync. As @f1337 it's terribly easy to do and it happens in practice all the time. I tried to work around this by having an npm post-publish hook that updates the version and tags it at the same time. In fact, this is already implemented in H9: https://github.com/pandastrike/haiku9/blob/master/package.json#L46 My hope was to build on that for CI. That is, we'd add the Docker build and publish step as part of the post-publish hook. But this approach has an annoying drawback in that it isn't tied to a commit. Which brings me back to my original question, which I dashed off thinking that everyone already knew about the post-publish hook in NPM. I really like the idea of using git hooks because it ties to the commit to all the CI/CD activity directly. Instead of a post-publish hook, we use a git hook. The git hook runs the tests and, presuming they pass, tags the release, pushes the tags, does the NPM publish, and builds and pushes the Docker image. Possibly not in that order, since if the NPM publish or Docker build/publish fail, we might want to avoid tagging the release. OTOH, there's no way to make them atomic operations (I don't think, although both NPM and Docker are getting more sophisticated by the day…) so in those cases, maybe we just log the errors. The reason I said |
1 similar comment
Yup. All these still have the same basic problem where everything gets out of sync. As @f1337 it's terribly easy to do and it happens in practice all the time. I tried to work around this by having an npm post-publish hook that updates the version and tags it at the same time. In fact, this is already implemented in H9: https://github.com/pandastrike/haiku9/blob/master/package.json#L46 My hope was to build on that for CI. That is, we'd add the Docker build and publish step as part of the post-publish hook. But this approach has an annoying drawback in that it isn't tied to a commit. Which brings me back to my original question, which I dashed off thinking that everyone already knew about the post-publish hook in NPM. I really like the idea of using git hooks because it ties to the commit to all the CI/CD activity directly. Instead of a post-publish hook, we use a git hook. The git hook runs the tests and, presuming they pass, tags the release, pushes the tags, does the NPM publish, and builds and pushes the Docker image. Possibly not in that order, since if the NPM publish or Docker build/publish fail, we might want to avoid tagging the release. OTOH, there's no way to make them atomic operations (I don't think, although both NPM and Docker are getting more sophisticated by the day…) so in those cases, maybe we just log the errors. The reason I said |
Meaning the specific hooks in h9 and in a few other repos. |
Specifically: an automated process which triggers the following when it detects a new tag. Given a new tag of
1.1.1
:package.json
to1.1.1
npm publish
Dockerfile
with the latest npm version (keep it explicit):npm install -g haiku9@1.1.1
latest
image:docker build . -t pandastrike/haiku9
docker tag pandastrike/haiku9 pandastrike/haiku9:1.1.1
docker push pandastrike/haiku9
The text was updated successfully, but these errors were encountered: