Skip to content

Commit 641f6cf

Browse files
authored
Add PR id to bucket URL (#1285)
Add Pull Request number as part of the bucket URL or the branch name (e.g. main). Artifacts uploaded in the pipeline have also been reviewed.
1 parent 8971cc5 commit 641f6cf

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

.buildkite/pipeline.trigger.integration.tests.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ for test in ${CHECK_PACKAGES_TESTS[@]}; do
4242
echo " provider: \"gcp\""
4343
echo " artifact_paths:"
4444
echo " - build/test-results/*.xml"
45-
echo " - build/elastic-stack-dump/stack/check-*/logs/*.log"
46-
echo " - build/elastic-stack-dump/stack/check-*/logs/fleet-server-internal/**/*"
47-
echo " - build/elastic-stack-status/*/*"
45+
echo " - build/elastic-stack-dump/check-*/logs/*.log"
46+
echo " - build/elastic-stack-dump/check-*/logs/fleet-server-internal/**/*"
4847
if [[ $test =~ with-kind$ ]]; then
4948
echo " - build/kubectl-dump.txt"
5049
fi
@@ -62,8 +61,6 @@ for package in $(find . -maxdepth 1 -mindepth 1 -type d) ; do
6261
echo " provider: \"gcp\""
6362
echo " artifact_paths:"
6463
echo " - build/test-results/*.xml"
65-
echo " - build/elastic-stack-dump/stack/check-*/logs/*.log"
66-
echo " - build/elastic-stack-dump/stack/check-*/logs/fleet-server-internal/**/*"
6764
done
6865

6966
popd > /dev/null

.buildkite/scripts/integration_tests.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ GOOGLE_CREDENTIALS_FILENAME="google-cloud-credentials.json"
3030

3131
JOB_GCS_BUCKET_INTERNAL="fleet-ci-temp-internal"
3232

33-
REPO_NAME=$(repoName "${BUILDKITE_REPO}")
34-
REPO_BUILD_TAG="${REPO_NAME}/${BUILDKITE_BUILD_NUMBER}"
35-
33+
REPO_NAME=$(repo_name "${BUILDKITE_REPO}")
34+
REPO_BUILD_TAG="${REPO_NAME}/$(buildkite_pr_branch_build_id)"
3635
TARGET=""
3736
PACKAGE=""
3837
while getopts ":t:p:h" o; do

.buildkite/scripts/signAndPublishPackage.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cleanup() {
1616

1717
trap cleanup EXIT
1818

19-
isAlreadyPublished() {
19+
is_already_published() {
2020
local packageZip=$1
2121

2222
if curl -s --head https://package-storage.elastic.co/artifacts/packages/${packageZip} | grep -q "HTTP/2 200" ; then
@@ -34,7 +34,7 @@ if ! command -v gsutil &> /dev/null ; then
3434
fi
3535

3636

37-
REPO_NAME=$(repoName "${BUILDKITE_REPO}")
37+
REPO_NAME=$(repo_name "${BUILDKITE_REPO}")
3838
BUILD_TAG="buildkite-${BUILDKITE_PIPELINE_SLUG}-${BUILDKITE_BUILD_NUMBER}"
3939

4040
REPO_BUILD_TAG="${REPO_NAME}/${BUILD_TAG}"
@@ -76,7 +76,7 @@ google_cloud_auth_publishing() {
7676
echo "${gsUtilLocation}"
7777
}
7878

79-
signPackage() {
79+
sign_package() {
8080
local package=${1}
8181
local packageZip=$(basename ${package})
8282

@@ -110,7 +110,7 @@ signPackage() {
110110
rm -r "${gsUtilLocation}"
111111
}
112112

113-
publishPackage() {
113+
publish_package() {
114114
local package=$1
115115
local packageZip=$(basename ${package})
116116

@@ -154,14 +154,14 @@ ls -l "${BUILD_PACKAGES_PATH}"
154154
for package in $(ls ${BUILD_PACKAGES_PATH}/*.zip); do
155155
echo "isAlreadyInstalled ${package}?"
156156
packageZip=$(basename ${package})
157-
if isAlreadyPublished ${packageZip} ; then
157+
if is_already_published ${packageZip} ; then
158158
echo "Skipping. ${packageZip} already published"
159159
continue
160160
fi
161161

162162
echo "Signing package ${packageZip}"
163-
signPackage "${package}"
163+
sign_package "${package}"
164164

165165
echo "Publishing package ${packageZip}"
166-
publishPackage "${package}"
166+
publish_package "${package}"
167167
done

.buildkite/scripts/tooling.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
repoName() {
4+
repo_name() {
55
# Example of URL: [email protected]:acme-inc/my-project.git
66
local repoUrl=$1
77

88
orgAndRepo=$(echo $repoUrl | cut -d':' -f 2)
99
echo "$(basename ${orgAndRepo} .git)"
1010
}
1111

12+
buildkite_pr_branch_build_id() {
13+
if [ "${BUILDKITE_PULL_REQUEST}" == "false" ]; then
14+
echo "${BUILDKITE_BRANCH}-${BUILDKITE_BUILD_NUMBER}"
15+
return
16+
fi
17+
echo "PR-${BUILDKITE_PULL_REQUEST}-${BUILDKITE_BUILD_NUMBER}"
18+
}
19+
1220
google_cloud_auth() {
1321
local keyFile=$1
1422

0 commit comments

Comments
 (0)