-
Notifications
You must be signed in to change notification settings - Fork 102
Proposal: Package release process #86
Comments
Overall I would like to move on this proposal very quickly so we can get the changes in place soon. |
for development, we can use the dev-next environment, there we can configure a package-registry inside the cluster. |
for snapshot and staging the deploy process is clear, every good merge in the branch publishes the images and kick the rollout in the service to grab the new images. In the snapshot environment, we can make a simple update of the pods, for staging I guess it is valid too, the downtime should be short. |
If we want to go with the manual release for production for now, we can come back the Jenkins approval process we discussed earlier. |
the downtime is because it has to start the new pods, stop the old pods, and change the service to point to the new pods, it really short seconds, but there is an outage.
on the merge, we would run all the test again, if we use blue-green deployment, we can deploy without disturbing the current green deploy, meanwhile, we can run additional tests over the blue deployment before changing it to green.
we can put additional logic to allow only a number of changes per hour or other controls, but keep it simple is always the best way so I think that serial deploy of all changes is fine.
If we have to make the PR, in any case, maybe the approval of the PR and the merge is enough approval. |
Why using the master branch of the package registry to serve snapshot packages? I think we should decouple development of packages from the development of the registry and its storage backends. In my opinion, packages on all stages should be served by released versions of the registry, ideally the same versions. This way we avoid blocking development of packages by issues introduced in the registry, or introducing features in packages that make them unsuitable to be promoted to staging/production.
We have to keep in mind that (hopefuly) at some point there may be other repositories with integrations that will need a way to release to a registry too.
Have we considered to support multiple registries? This can be interesting for organizations that develop their own packages, they could use
I guess there can be some time between a version of a package is "released", and it is actually published and available on each environment. It can be still interesting to register when packages are effectively published.
I don't think we should support "unreleasing" released packages, even if possible with a git-based approach. |
@ruflin I think it might be helpful to have a CI script (maybe in jenkins?) where you could enter or select the package you want to move from
What's the benefit of removing it from staging? Reducing the clutter? Once it's deployed to staging it will need to be redeployed to snapshot right since snapshot has
Yeah currently the security/endpoint team has their own repo: https://github.com/elastic/endpoint-package . We're hoping to leverage this release process as well. |
I'm loving this conversation. There is just so much to digest here... I appreciate @jsoriano 's comment about having the actual Registry code pulled a known stable version. I suppose It Depends. I would guess that Beats & Kibana ci would generally want to pull known stable versions, while the Registry & Packages ci may more generally want to pull latest versions in development? I still think the process discussion around package update communications with Customers will be important to flesh out, either here or in another ticket. Tho I may still be thinking about this different than what we're planning to support. One question comes up: will an ELK stack admin be able to 'downgrade' to latest-minus-1 package if needed for some reason, for the System and Endpoint packages (the others can be un-installed, but those that are built in I was thinking would maybe need yet more special logic code)? |
|
Yep, it depends on the use that we make of each environment, but if the environments described here are going to be used for the package release process, and as a way to share packages during development and testing, I think that they should use controlled versions, ideally stable ones. Registry and Packages CI should probably be separated things, each one with their own dependencies.
Not sure how to do it. Not sure if even neccesary :) I only wanted to remark that only with Git we may not have all the control on when things happen. For example with S3, or a normal filesystem, you can know when certain files were modified, and you can also audit modifications. |
That's my initial idea to promote the binaries, but we have three "release" branches and each one is a different stage, so I guess that what we promote are the changes between those branches and then we release the binary.
you always need to differentiate in some way the old pod from the new pod, so you need to tag new versions with a different tag whatever you want. The thing here is, we have two branches on package-registry and package-storage, |
@kuisathaverat Quoting from my initial description:
Based on the comment from @jsoriano I think we can assume that each version of a package-storage branch is tied to a very specific version of the registry moving forward (not the case today). |
if this is the case you only have one version number and two flavors (stable and experimental). |
I had a follow up chat with @kuisathaverat to dive a bit more into this. What I plan to do as a next step is to move this forward is to create the snapshot branch with a POC for this. It will contain the existing packages + everything we need for the above. The Docker containers which will be created will be:
We need the commit hash docker images for the deployment to make it reproducible. Ivan will start to look into the blue-green deployment. As soon as I have a branch ready, I'll share it here. |
I branched of |
A side note: this thread is getting a bit too long, would be nice to write up summary once decided, so that everyone can review it. |
Here a quick summary of the current state and the steps forward. The main thing which changed from the initial proposal is that for all branches we use a fixed version of the package-registry. We didn't settle yet on the final way how the deployment of production will work. Here is the updated table:
Now lets dig into the phases. Phase 1 - Basic setupPhase 1 is about getting all the basics in place to start working on top of it.
Phase 2 - Move over development / relaseIn Phase 2, the development / releases should be switched over to the new branches:
Phase 3 - CleanupCleanup on the existing branches should happen.
|
As part of elastic/package-storage#86 the way packages are released is changed. The release process will be snapshot -> staging -> production. This PR now first switches over to directly open PR's against production to move away from master. This allows us to update the deployment of epr.elastic.co to point to production branch instead and start to cleanup / remove the master branch. The second step will be to adjust the script that it directly pushed to snapshot and we then have a release script to promote packages from snapshot to staging to production.
@ruflin @jen-huang In Kibana, we can determine if a cluster is running a snapshot by using the I don't know if it's available when we initially assign the registry url but we could work the logic into https://github.com/elastic/kibana/blob/a00051f91471378fb2e1f882eb88b15c2fbb1e97/x-pack/plugins/ingest_manager/server/services/epm/registry/registry_url.ts#L23 without much issue Is it possible for the various environments to start Kibana with the |
As part of elastic/package-storage#86 the way packages are released is changed. The release process will be snapshot -> staging -> production. This PR now first switches over to directly open PR's against production to move away from master. This allows us to update the deployment of epr.elastic.co to point to production branch instead and start to cleanup / remove the master branch. The second step will be to adjust the script that it directly pushed to snapshot and we then have a release script to promote packages from snapshot to staging to production.
@jfsiii Would be great to have some logic like the above. We could probably also do without special logic by saying: |
As part of elastic#86 the master branch will not be used anymore. By now, all packages have been moved over to the production branch and it is ready to be deployed under `epr.elastic.co`. All future contributions of packages should go to the production branch or as soon as staging and snapshot deployment are fully available + promotion script, follow the new process. The master branch will need to be updated to remove most code and the README should be updated to contain details around the branch and usage instead. I'm removing first most packages to prevent accidental contributions to the master branch but still keep tooling working. Further cleanups will follow.
As part of elastic#86 the master branch will not be used anymore. By now, all packages have been moved over to the production branch and it is ready to be deployed under `epr.elastic.co`. All future contributions of packages should go to the production branch or as soon as staging and snapshot deployment are fully available + promotion script, follow the new process. The master branch will need to be updated to remove most code and the README should be updated to contain details around the branch and usage instead. I'm removing first most packages to prevent accidental contributions to the master branch but still keep tooling working. Further cleanups will follow.
The Dockerfile for the registry itself should not contain any packages. Instead it should be empty and there are other distributions with packages, see elastic/package-storage#86. This removes the packages from the default Docker build.
Update on the current status of this migration:
The integrations repo was update to open PRs against production for now but a release script is still needed to allow the new workflow. An initial idea on how the promote script could look like is open here: #110 |
The Dockerfile for the registry itself should not contain any packages. Instead it should be empty and there are other distributions with packages, see elastic/package-storage#86. This removes the packages from the default Docker build. Few additional changes in the this PR: * Split up the Dockerfile in two stages to reduce the size of the image. Thanks @jsoriano for the contribution * Switch over to production packages instead of master * Select /packages as default path
The Dockerfile for the registry itself should not contain any packages. Instead it should be empty and there are other distributions with packages, see elastic/package-storage#86. This removes the packages from the default Docker build. Few additional changes in the this PR:
As part of elastic#86 the master branch will not be used anymore. By now, all packages have been moved over to the production branch and it is ready to be deployed under `epr.elastic.co`. All future contributions of packages should go to the production branch or as soon as staging and snapshot deployment are fully available + promotion script, follow the new process. This PR removes all packages and big junk of the code. Further cleanup will be needed. The goal of this PR is to make sure this registry is not used anymore moving forward.
As part of #86 the master branch will not be used anymore. By now, all packages have been moved over to the production branch and it is ready to be deployed under `epr.elastic.co`. All future contributions of packages should go to the production branch or as soon as staging and snapshot deployment are fully available + promotion script, follow the new process. This PR removes all packages and big junk of the code. Further cleanup will be needed. The goal of this PR is to make sure this registry is not used anymore moving forward.
…70687) With elastic/package-storage#86 we have now 3 registries available: production, staging, snapshot. Our current master snapshot build should point to the snapshot registry. The 7.x and 7.8 branch both should point to the production registry. It means, if someone runs the master snapshot builds, he always has the most recent packages available. This also ensures, we don't accidentally ship with the production registry. The only time we need to be careful, is when we will branch of 8.x from master. At this stage, we need to switch over the registry in 8.x to prod again. The registry URL used is: https://epr-snapshot.ea-web.elastic.dev The reasons is that the CDN URL is not deployed yet. As soon as the CDN is available, we should switch it over to : https://epr-snapshot.elastic.co The reason I'm already switching over is to make sure we can use the snapshot branch as soon as possible.
Update on the progress:
The main piece missing now is the promotion script. I'm going to close this issue now and follow up with a separate issue on the release script. |
As part of elastic/package-storage#86 the way packages are released is changed. The release process will be snapshot -> staging -> production. This PR now first switches over to directly open PR's against production to move away from master. This allows us to update the deployment of epr.elastic.co to point to production branch instead and start to cleanup / remove the master branch. The second step will be to adjust the script that it directly pushed to snapshot and we then have a release script to promote packages from snapshot to staging to production.
This proposal on how the deployment of the package registry and package storage should change.
Problem
With the current way the package-storage is deployed, there is no easy way to have different environments for production, QA or snapshots. If someone builds a package and wants to share it for testing with others, the tester is required to setup the testing environment local and run it with a local registry.
There is also no process to have certain packages in a QA stage before they are shipped to production.
Goals
The following proposal dives into how the above can be solved. But even though multiple stages of deployment are introduced, it should still be as easy as possible to release a new package. The different stages of deployment can be followed but it is not a strict requirement.
Note: At the moment we have an additional "experimental" environment which goes away in the near future and is ignored on purpose in this proposal.
Environments
To make testing and snapshot builds possible, three environments are needed:
Each of these environments is tied to a specific version of the package-storage and the package-registry and has different rules on how packages are added. These are described in more details below.
Snapshot environment
The snapshot environment is to share the latest versions of packages and testing it together with the snapshot builds of the Elastic Stack. New packages are added and updated at any time and in most cases fully automated. In the snapshot branch it is allowed to overwrite / update existing versions.
Addition of packages are done through direct commits to the branch. It is expected, that any package updates pushed to the branch are already pre-checked by CI by the contributor.
The branch used for the snapshot packages is called
snapshot
in the package-storage repositories. The related package-registry is the one in themaster
branch. Every time a new commit is pushed to the package-storage snapshot branch or the package-registry master branch a new build is kicked off. The build is expected to pass as precheckes should have happened, if not, the contributors are pinged and deployment does not happen.Taking the integrations repository as an example, every time a PR is merged, a script will trigger a commit to the
snapshot
branch with the updated version. This will trigger a build and a new registry is deployed.The snapshot registry is available under
epr-snapshot.elastic.co
.Snapshot is NOT a package development environment. All changes and tests should happen outside the snapshot branch and only the final result of changes is pushed.
The snapshot registry is a combination of production + staging + snapshot packages. If the same version exists in production and snapshot, the production version is taken as these should not conflict. Having all packages together in snapshot also allows to do upgrade tests.
Staging environment
The staging environment is meant for testing packages which are ready for deployment. Talking in terms of directory, moving to staging is moving a directory from snapshot to staging, meaning the package will be removed from snpashot. In most cases, when a package enters staging, it is expected not to change anymore. But if issues are found, changes can be picked again from the snapshot branch. A script is expected to do the work taking a package from snapshot and pushing it to staging.
From the deployment perspective it is the same as the snapshot build, it is continously built.
It links to a specific release version of the registry. If the registry is updated, the registry reference has to be updated manually. This is to ensure all CI builds are consistent.
The staging environment is expected to be used on SNAPSHOT branches.
The url used is
epr-staging.elastic.co
.Production environment
The production branch is used for all the released packages. These packages should never be changed / updated after they are released. Contributions to the production branch happend through a PR to make sure CI checks can be run in advance. These PR are normally opened by a script taking a package from the staging branch. As soon as it is merged into production, the staging version should be removed. For now the merging of these PR's need to happen manually, but it could be automated if CI is green for "trusted" contributors.
The registry is tied to a specific release tag. As soon as a PR is merged in the production branch, it is deployment automatically to
epr.elastic.co
.Summary
In summary, the above gives us 3 different environments. Deployments of each environment happens fully automated as soon as a commit is added to the branch. Only in the case of production, the addition of a package has to go through a PR to have a previous CI check guaranteed.
Below is a summary table of the 3 environments:
How to get to this new deployment
Today all packages are in the
master
branch. To make the above possible, theintegrations
repository script has to be adjusted and an additional script has to be built, to move packages between the different version.On the Kibana side, a way must be found the SNAPSHOT builds point to a different version of the registry then development. Or the production one could be just the default and it needs manual adjustment.
Why Git and branches
Instead of using Git for the above, it would also be possible to just use a directory structure on S3 or similar. But the nice thing about Git is that it shows us exactly what happened when and by who in the past, and in extreme casees allows us to roll back changes if needed. In addition for the production registry it allows us to the use a manual PR review to have CI checks in advance. The part that is a bit more combuersome is moving packages between branches, but scripts can do this for us.
The text was updated successfully, but these errors were encountered: