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

[CI] Fix publish script #188027

Merged
merged 8 commits into from
Jul 16, 2024
60 changes: 36 additions & 24 deletions .buildkite/scripts/steps/artifacts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,39 +54,51 @@ echo "--- Pull latest Release Manager CLI"
docker pull docker.elastic.co/infra/release-manager:latest

echo "--- Publish artifacts"
if [[ "$BUILDKITE_BRANCH" == "$KIBANA_BASE_BRANCH" ]]; then
if [[ "$BUILDKITE_BRANCH" == "$KIBANA_BASE_BRANCH" ]] || [[ "${DRY_RUN:-}" =~ ^(1|true)$ ]]; then
export VAULT_ROLE_ID="$(get_vault_role_id)"
export VAULT_SECRET_ID="$(get_vault_secret_id)"
export VAULT_ADDR="https://secrets.elastic.co:8200"

download_artifact beats_manifest.json /tmp --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}"
export BEATS_MANIFEST_URL=$(jq -r .manifest_url /tmp/beats_manifest.json)

PUBLISH_CMD=$(cat << EOF
docker run --rm \
--name release-manager \
-e VAULT_ADDR \
-e VAULT_ROLE_ID \
-e VAULT_SECRET_ID \
--mount type=bind,readonly=false,src="$PWD/target",target=/artifacts/target \
docker.elastic.co/infra/release-manager:latest \
cli collect \
--project kibana \
--branch "$KIBANA_BASE_BRANCH" \
--commit "$GIT_COMMIT" \
--workflow "$WORKFLOW" \
--version "$BASE_VERSION" \
--qualifier "$VERSION_QUALIFIER" \
--dependency "beats:$BEATS_MANIFEST_URL" \
--artifact-set main
EOF
)
if [[ "${DRY_RUN:-}" =~ ^(1|true)$ ]]; then
PUBLISH_CMD+=(" --dry-run")
if [[ "$DRY_RUN" =~ ^(1|true)$ ]]; then
docker run --rm \
--name release-manager \
-e VAULT_ADDR \
-e VAULT_ROLE_ID \
-e VAULT_SECRET_ID \
--mount type=bind,readonly=false,src="$PWD/target",target=/artifacts/target \
docker.elastic.co/infra/release-manager:latest \
cli collect \
--project kibana \
--branch "$KIBANA_BASE_BRANCH" \
--commit "$GIT_COMMIT" \
--workflow "$WORKFLOW" \
--version "$BASE_VERSION" \
--qualifier "$VERSION_QUALIFIER" \
--dependency "beats:$BEATS_MANIFEST_URL" \
--artifact-set main \
--dry-run
else
docker run --rm \
--name release-manager \
-e VAULT_ADDR \
-e VAULT_ROLE_ID \
-e VAULT_SECRET_ID \
--mount type=bind,readonly=false,src="$PWD/target",target=/artifacts/target \
docker.elastic.co/infra/release-manager:latest \
cli collect \
--project kibana \
--branch "$KIBANA_BASE_BRANCH" \
--commit "$GIT_COMMIT" \
--workflow "$WORKFLOW" \
--version "$BASE_VERSION" \
--qualifier "$VERSION_QUALIFIER" \
--dependency "beats:$BEATS_MANIFEST_URL" \
--artifact-set main
fi

"${PUBLISH_CMD[@]}"

KIBANA_SUMMARY=$(curl -s "$KIBANA_MANIFEST_LATEST" | jq -re '.summary_url')

cat << EOF | buildkite-agent annotate --style "info" --context artifacts-summary
Expand Down