Skip to content

Commit 1619418

Browse files
committed
Setup BuildKite pipeline (#679)
1 parent 14c20bd commit 1619418

File tree

2 files changed

+71
-2
lines changed

2 files changed

+71
-2
lines changed

.buildkite/pipeline.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
steps:
2-
- label: ":java: Greetings"
3-
command: "echo 'Hello, world!'"
2+
- label: ":java: :elasticsearch: Elasticsearch Java API client - {{matrix.workflow}}"
3+
agents:
4+
provider: "gcp"
5+
branches: [ "main", "8.10" ]
6+
matrix:
7+
setup:
8+
workflow:
9+
- "snapshot"
10+
- "staging"
11+
command: ".ci/release.sh {{matrix.workflow}}"

.ci/release.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to Elasticsearch B.V. under one or more contributor
4+
# license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright
6+
# ownership. Elasticsearch B.V. licenses this file to you under
7+
# the Apache License, Version 2.0 (the "License"); you may
8+
# not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
set -euo pipefail
22+
23+
WORKFLOW=$1
24+
STACK_VERSION=$(cat config/version.txt)
25+
26+
# Branch: BRANCH env var > Buildkite's BUILDKITE_BRANCH var > minor version
27+
BRANCH=${BRANCH:-${BUILDKITE_BRANCH:-${STACK_VERSION%.*}}}
28+
29+
if [[ "$BRANCH" = "main" && "$WORKFLOW" = "staging" ]]; then
30+
echo "No staging build for the main branch - skipping"
31+
exit 0
32+
fi
33+
34+
# Add snapshot suffix if needed
35+
BUILD_VERSION=$STACK_VERSION
36+
[ "$WORKFLOW" = "snapshot" ] && BUILD_VERSION="${BUILD_VERSION}-SNAPSHOT"
37+
38+
echo "Releasing version $STACK_VERSION, branch: $BRANCH, workflow: $WORKFLOW"
39+
40+
DRA_CREDS=$(vault kv get -field=data -format=json kv/ci-shared/release/dra-role)
41+
42+
.ci/make.sh assemble "$BUILD_VERSION"
43+
44+
# set required permissions on artifacts and directory
45+
chmod -R a+r $PWD/.ci/output/*
46+
chmod -R a+w $PWD/.ci/output
47+
# Artifacts should be generated
48+
docker run --rm \
49+
--name release-manager \
50+
-e VAULT_ADDR="$(echo "$DRA_CREDS" | jq -r '.vault_addr')" \
51+
-e VAULT_ROLE_ID="$(echo "$DRA_CREDS" | jq -r '.role_id')" \
52+
-e VAULT_SECRET_ID="$(echo "$DRA_CREDS" | jq -r '.secret_id')" \
53+
--mount type=bind,readonly=false,src="$PWD",target=/artifacts \
54+
docker.elastic.co/infra/release-manager:latest \
55+
cli collect \
56+
--project elasticsearch-java \
57+
--branch "$BRANCH" \
58+
--commit "$(git rev-parse HEAD)" \
59+
--workflow "$WORKFLOW" \
60+
--version "$STACK_VERSION" \
61+
--artifact-set main

0 commit comments

Comments
 (0)