-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
steps: | ||
- label: ":java: Greetings" | ||
command: "echo 'Hello, world!'" | ||
- label: ":java: :elasticsearch: Elasticsearch Java API client - {{matrix.workflow}}" | ||
agents: | ||
provider: "gcp" | ||
branches: [ "main", "8.10" ] | ||
matrix: | ||
setup: | ||
workflow: | ||
- "snapshot" | ||
- "staging" | ||
command: ".ci/release.sh {{matrix.workflow}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to Elasticsearch B.V. under one or more contributor | ||
# license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright | ||
# ownership. Elasticsearch B.V. licenses this file to you under | ||
# the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
set -euo pipefail | ||
|
||
WORKFLOW=$1 | ||
STACK_VERSION=$(cat config/version.txt) | ||
|
||
# Branch: BRANCH env var > Buildkite's BUILDKITE_BRANCH var > minor version | ||
BRANCH=${BRANCH:-${BUILDKITE_BRANCH:-${STACK_VERSION%.*}}} | ||
|
||
if [[ "$BRANCH" = "main" && "$WORKFLOW" = "staging" ]]; then | ||
echo "No staging build for the main branch - skipping" | ||
exit 0 | ||
fi | ||
|
||
# Add snapshot suffix if needed | ||
BUILD_VERSION=$STACK_VERSION | ||
[ "$WORKFLOW" = "snapshot" ] && BUILD_VERSION="${BUILD_VERSION}-SNAPSHOT" | ||
|
||
echo "Releasing version $STACK_VERSION, branch: $BRANCH, workflow: $WORKFLOW" | ||
|
||
DRA_CREDS=$(vault kv get -field=data -format=json kv/ci-shared/release/dra-role) | ||
|
||
.ci/make.sh assemble "$BUILD_VERSION" | ||
|
||
# set required permissions on artifacts and directory | ||
chmod -R a+r $PWD/.ci/output/* | ||
chmod -R a+w $PWD/.ci/output | ||
# Artifacts should be generated | ||
docker run --rm \ | ||
--name release-manager \ | ||
-e VAULT_ADDR="$(echo "$DRA_CREDS" | jq -r '.vault_addr')" \ | ||
-e VAULT_ROLE_ID="$(echo "$DRA_CREDS" | jq -r '.role_id')" \ | ||
-e VAULT_SECRET_ID="$(echo "$DRA_CREDS" | jq -r '.secret_id')" \ | ||
--mount type=bind,readonly=false,src="$PWD",target=/artifacts \ | ||
docker.elastic.co/infra/release-manager:latest \ | ||
cli collect \ | ||
--project elasticsearch-java \ | ||
--branch "$BRANCH" \ | ||
--commit "$(git rev-parse HEAD)" \ | ||
--workflow "$WORKFLOW" \ | ||
--version "$STACK_VERSION" \ | ||
--artifact-set main |