Skip to content

Commit

Permalink
Merge pull request #33205 from vespa-engine/aressem/set-environment-a…
Browse files Browse the repository at this point in the history
…nd-create-build

Set environment from factory and run create-build for both steps MERGEOK
  • Loading branch information
aressem authored Jan 28, 2025
2 parents 965ed30 + 5f8d2ef commit 108bdbb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
36 changes: 18 additions & 18 deletions .buildkite/plugins/factory-reporter/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@ if [[ $SKIP_BUILDKITE_PLUGINS == "true" ]]; then
echo "SKIP_BUILDKITE_PLUGINS is set. Skipping factory reporter"
exit 0
fi
if [[ $BUILDKITE_PULL_REQUEST != "false" ]]; then
echo "This is a pull request, skipping factory reporter"
exit 0
fi
if [[ -z $PIPELINE ]]; then
echo "No pipeline ID found, skipping factory reporter"
exit 0
fi

if [[ -z $FIRST_STEP ]] || [[ $FIRST_STEP != "true" ]]; then
echo "Not first step, skipping build creation"
exit 0
fi
if [[ $BUILDKITE_PULL_REQUEST == "false" ]]; then
JSON=$($BUILDKITE_BUILD_CHECKOUT_PATH/.buildkite/factory-command.sh create-build $PIPELINE)

JSON=$($BUILDKITE_BUILD_CHECKOUT_PATH/.buildkite/factory-command.sh create-build $PIPELINE)
echo "Output from creating build : $JSON"

echo "Output from creating build : $JSON"
VESPA_FACTORY_BUILD_ID=$(jq -re '.buildId' <<< "$JSON")
export VESPA_FACTORY_BUILD_ID

VESPA_FACTORY_BUILD_ID=$(jq -re '.buildId' <<< "$JSON")
export VESPA_FACTORY_BUILD_ID
VARIABLES=$(jq -r '.variables | to_entries | .[] | "export \(.key)=\(.value|tojson)"' <<< "$JSON")
eval "$VARIABLES"

VESPA_VERSION=$(jq -re .version <<< "$JSON")
export VESPA_VERSION
buildkite-agent meta-data set vespa-version $VESPA_VERSION
VESPA_VERSION=$(jq -re .version <<< "$JSON")
export VESPA_VERSION
buildkite-agent meta-data set vespa-version $VESPA_VERSION

echo "Created factory build $VESPA_FACTORY_BUILD_ID for pipeline $PIPELINE"
echo "Created factory build $VESPA_FACTORY_BUILD_ID for pipeline $PIPELINE"

$BUILDKITE_BUILD_CHECKOUT_PATH/.buildkite/factory-command.sh update-build-status $PIPELINE running "Building"
$BUILDKITE_BUILD_CHECKOUT_PATH/.buildkite/factory-command.sh update-build-status $PIPELINE running "Building"

echo "Set factory build $VESPA_FACTORY_BUILD_ID status to running"
echo "Set factory build $VESPA_FACTORY_BUILD_ID status to running"
else
VESPA_VERSION="$(curl -sSLf 'https://api.factory.vespa.ai/factory/v1/latest-successful-build?platform=opensource_centos7&vespaMajor=8' | jq -re .version)"
export VESPA_VERSION
buildkite-agent meta-data set vespa-version $VESPA_VERSION
fi
1 change: 1 addition & 0 deletions .buildkite/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

set -euo pipefail
set -x

"$SOURCE_DIR/.buildkite/replace-vespa-version-in-poms.sh" "$VESPA_VERSION" "$SOURCE_DIR"

Expand Down

0 comments on commit 108bdbb

Please sign in to comment.