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

[Fleet] Use staging registry for SNAPSHOT builds #90131

Closed
ruflin opened this issue Feb 3, 2021 · 16 comments · Fixed by #90327
Closed

[Fleet] Use staging registry for SNAPSHOT builds #90131

ruflin opened this issue Feb 3, 2021 · 16 comments · Fixed by #90327
Assignees
Labels
Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@ruflin
Copy link
Member

ruflin commented Feb 3, 2021

Today in Fleet for builds off the master branch, the snapshot registry is used, for all other environments the production registry:

const getDefaultRegistryUrl = (): string => {
This makes it hard to test against staging in Cloud as the registry URL cannot be modified.

The proposal here is to use the staging registry for all -SNAPSHOT builds. The logic would then be something like:

if (branch === 'master') {
  return SNAPSHOT_REGISTRY_URL_CDN;
} else if (string_contains(version, '-SNAPSHOT)){
  return STAGING_REGISTRY_URL_CDN;
{ else }
  return PRODUCTION_REGISTRY_URL_CDN;
}

This would allow to test the staging branch with elastic-package and on Cloud by selecting a -SNAPSHOT build. For example to test staging for 7.11.0, the container 7.11.0-SNAPSHOT would be used, to test against production, 7.11.0.

@ruflin ruflin added Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team labels Feb 3, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Feature:Fleet)

@ruflin
Copy link
Member Author

ruflin commented Feb 3, 2021

@EricDavisX Would be great to get your feedback on the above if this would be helpful.

@EricDavisX
Copy link
Contributor

This is excellent, and I had the same idea myself last night! I see no real risk here, as the logic is still quite simple. This fits in well with what our desired process is and allows better (#CloudFirst) testing across the needed releases, excellent indeed! :shipit:

@ph
Copy link
Contributor

ph commented Feb 3, 2021

@ruflin This looks like a good idea to reduce some of the concerns with what version is out or not. I am not sure there is a way to detect if you are in master other than for checking for 8.0.0 but @jen-huang might know more :)

@ruflin
Copy link
Member Author

ruflin commented Feb 3, 2021

The build contains the branch and this check already exists today. So only change needed is for staging.

@skh
Copy link
Contributor

skh commented Feb 3, 2021

What @ruflin says, we have kibanaVersion and kibanaBranch in our app context. kibanaVersion may contain -SNAPSHOT, see for example here: https://github.com/elastic/kibana/blob/master/x-pack/plugins/fleet/server/services/epm/registry/index.ts#L68

So the information is there, and can be used when deciding which registry to use.

@ruflin
Copy link
Member Author

ruflin commented Feb 3, 2021

Based on the reference from @skh seems like all the info is available also in Fleet in existing variables 🎉

@skh Do you know if I build Kibana from source if there is a way to specify if it should be SNAPSHOT or not? I'm wondering how to test an implementation before it is backported 🤔

@EricDavisX
Copy link
Contributor

Does Kibana CI build the Kibana Docker container that we could reference / use?

@skh
Copy link
Contributor

skh commented Feb 3, 2021

@ruflin node scripts/build --release should build without -SNAPSHOT but I haven't tried.

@EricDavisX
Copy link
Contributor

As I see the risk, the test goal is to build Kibana with -SNAPSHOT in the version. So from SKH's note, if we remove --release then that would solve it I guess. Excellent!

@jen-huang
Copy link
Contributor

@skh Handing ownership of this to you as @ruflin is PTO this week :) I left an approval on #90327 so feel free to merge and backport that when you're ready.

skh pushed a commit that referenced this issue Feb 10, 2021
The staging registry is used in Kibana builds which are not built of the master branch or release version. This means, any build ending with `-SNAPSHOT` not the master branch will use the staging registry.

Closes #90131

Co-authored-by: Jen Huang <its.jenetic@gmail.com>
skh pushed a commit to skh/kibana that referenced this issue Feb 10, 2021
The staging registry is used in Kibana builds which are not built of the master branch or release version. This means, any build ending with `-SNAPSHOT` not the master branch will use the staging registry.

Closes elastic#90131

Co-authored-by: Jen Huang <its.jenetic@gmail.com>
skh added a commit that referenced this issue Feb 10, 2021
The staging registry is used in Kibana builds which are not built of the master branch or release version. This means, any build ending with `-SNAPSHOT` not the master branch will use the staging registry.

Closes #90131

Co-authored-by: Jen Huang <its.jenetic@gmail.com>

Co-authored-by: Nicolas Ruflin <spam@ruflin.com>
Co-authored-by: Jen Huang <its.jenetic@gmail.com>
@EricDavisX
Copy link
Contributor

@skh can you backport to 7.11.1+ as well? This will help testing during the next cycle of Integrations (which need to work on 7.11.x). the setup work (time) and complexity is proving a real blocker for us to test them, even though it seems like we have it sorted out now. the backport would save us significant time and give much confidence in the test effort.

skh pushed a commit to skh/kibana that referenced this issue Feb 11, 2021
The staging registry is used in Kibana builds which are not built of the master branch or release version. This means, any build ending with `-SNAPSHOT` not the master branch will use the staging registry.

Closes elastic#90131

Co-authored-by: Jen Huang <its.jenetic@gmail.com>
# Conflicts:
#	x-pack/plugins/fleet/server/services/epm/registry/registry_url.ts
@skh
Copy link
Contributor

skh commented Feb 11, 2021

@EricDavisX backport to 7.11 is here: #91088

@skh
Copy link
Contributor

skh commented Feb 11, 2021

@EricDavisX It looks like 7.11.1 is already final, so this backport will probably land in 7.11.2.

skh added a commit that referenced this issue Feb 11, 2021
The staging registry is used in Kibana builds which are not built of the master branch or release version. This means, any build ending with `-SNAPSHOT` not the master branch will use the staging registry.

Closes #90131

Co-authored-by: Jen Huang <its.jenetic@gmail.com>
# Conflicts:
#	x-pack/plugins/fleet/server/services/epm/registry/registry_url.ts

Co-authored-by: Nicolas Ruflin <spam@ruflin.com>
@EricDavisX
Copy link
Contributor

they incremented the Kibana commit in 7.11.1 so, I guess it got picked up. it is all good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants