-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[build] Upload CDN assets #173159
[build] Upload CDN assets #173159
Conversation
Pinging @elastic/kibana-core (Team:Core) |
Pinging @elastic/kibana-operations (Team:Operations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM although I'm relying on CI's approval here
buildkite test this |
CDN_ASSETS_FOLDER=$(mktemp -d) | ||
tar -xf "kibana-$BASE_VERSION-cdn-assets.tar.gz" -C "$CDN_ASSETS_FOLDER" --strip=1 | ||
|
||
gsutil -m cp -r "$CDN_ASSETS_FOLDER/*" "gs://$GCS_SA_CDN_QA_BUCKET/$GIT_ABBREV_COMMIT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would we construct this path to point to the static assets from index.html? We already use a build number https://github.com/elastic/kibana/blob/main/packages/core/rendering/core-rendering-server-internal/src/bootstrap/bootstrap_renderer.ts#L82
Is this GIT_ABBREV_COMMIT
hash included in any of the RawPackageInfo fields https://github.com/elastic/kibana/blob/main/packages/kbn-config/src/env.ts#L45-L48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build number doesn't contain all assets and in a branching scenario can cause conflicts.
% tree -L 3
.
├── 70129
│ └── bundles
│ ├── core
│ ├── kbn-monaco
│ ├── kbn-ui-shared-deps-npm
│ ├── kbn-ui-shared-deps-src
│ └── plugin
└── ui
├── favicons
│ ├── favicon.distribution.ico
│ ├── favicon.distribution.png
│ ├── favicon.distribution.svg
│ ├── favicon.ico
│ ├── favicon.png
│ └── favicon.svg
├── fonts
│ ├── inter
│ └── roboto_mono
├── legacy_dark_theme.css
├── legacy_dark_theme.min.css
├── legacy_light_theme.css
└── legacy_light_theme.min.css
13 directories, 10 files
Is this GIT_ABBREV_COMMIT hash included in any of the RawPackageInfo fields https://github.com/elastic/kibana/blob/main/packages/kbn-config/src/env.ts#L45-L48
It is, build.sha{0,12}. It's also available to the controller as the id used to reference a build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the label(s) to upload the assets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"deploying" assets from main is useful for testing but could cause the bucket to fill up. We'd want to just check in a month or so how much storage space this consumes and perhaps add some kind of clean up.
Tested at https://buildkite.com/elastic/kibana-pull-request/builds/185740#018cd137-3289-4436-b145-a76601626d6a. The build failed on the project deploy step, but it's unrelated - we're not using the CDN yet. I'm looking into it on another thread. An example asset is https://kibana-cdn.gcp.qa.cld.elstc.co/db0dcc65ad07/70433/bundles/plugin/infra/1.0.0/4bc2b11b721c9874ba512ea725c670a6.png |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
In #173159 we authenticated with another service account, and were no longer operating under the expected config. This was causing `gcloud secrets` to access the wrong project and throw errors. This revokes the service account after we're done uploading CDN assets so we can switch back to the default service account. --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
In elastic#173159 we authenticated with another service account, and were no longer operating under the expected config. This was causing `gcloud secrets` to access the wrong project and throw errors. This revokes the service account after we're done uploading CDN assets so we can switch back to the default service account. --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
In elastic#173159 we authenticated with another service account, and were no longer operating under the expected config. This was causing `gcloud secrets` to access the wrong project and throw errors. This revokes the service account after we're done uploading CDN assets so we can switch back to the default service account. --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This uploads CDN assets to a GCS bucket on commit and after all tests have passed. This will run on pull requests with
ci:project-deploy-*
andci:build-serverless-image
labels, and onmain
. Assets will include the first 12 digits of the commit sha as a base path.