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(bk): use specialised VMs #3555

Merged
merged 4 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .buildkite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is the Buildkite pipeline for releasing the APM Agent Java.
### Pipeline Configuration

To view the pipeline and its configuration, click [here](https://buildkite.com/elastic/apm-agent-java-release) or
go to the definition in the `elastic/ci` repository.
go to the definition in `release.yml`.

### Credentials

Expand All @@ -25,7 +25,7 @@ This is the Buildkite pipeline for the APM Agent Java in charge of the snapshots
### Pipeline Configuration

To view the pipeline and its configuration, click [here](https://buildkite.com/elastic/apm-agent-java-snapshot) or
go to the definition in the `elastic/ci` repository.
go to the definition in `snapshot.yml`.

## opentelemetry-benchmark pipeline

Expand All @@ -35,3 +35,15 @@ This is the Buildkite pipeline for the Opentelemetry Benchmark.

To view the pipeline and its configuration, click [here](https://buildkite.com/elastic/apm-agent-java-opentelemetry-benchmark) or
go to the definition in `opentelemetry-benchmark.yml`.

## Buildkite VM runners

A set of Buildkite VM runners has been created for this repository. The VM runners contain
the required software:
* JDK
* GPG
* Maven dependencies

If a new version of Java is required, update the `.java-version` file with the latest major. When the changes are merged onto `main,` wait for the following day; that's when the automation will be responsible for recreating the VM with the new Java version.

If you would like to know more about how it works, please go to https://github.com/elastic/ci-agent-images/tree/main/vm-images/apm-agent-java (**NOTE**: only available for Elastic employees)
16 changes: 10 additions & 6 deletions .buildkite/hooks/prepare-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ set -euo pipefail
JAVA_VERSION=$(cat .java-version | xargs | tr -dc '[:print:]')
JAVA_HOME="${HOME}/.java/openjdk${JAVA_VERSION}"
export JAVA_HOME
PATH="${JAVA_HOME}/bin:$PATH"
PATH="${JAVA_HOME}/bin:${PATH}"
export PATH

# Fallback to install at runtime
if [ ! -d "${JAVA_HOME}" ] ; then
if [ -d "${JAVA_HOME}" ] ; then
echo "--- Skip installing JDK${JAVA_VERSION} :java:"
echo "already available in the Buildkite runner"
else
# Fallback to install at runtime
# This should not be the case normally untless the .java-version file has been changed
# and the VM Image is not yet available with the latest version.
echo "--- Install JDK${JAVA_VERSION} :java:"
JAVA_URL=https://jvm-catalog.elastic.co/jdk
JAVA_PKG="${JAVA_URL}/latest_openjdk_${JAVA_VERSION}_linux.tar.gz"
curl -L --output /tmp/jdk.tar.gz "$JAVA_PKG"
mkdir -p "$JAVA_HOME"
tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1
curl -L --output /tmp/jdk.tar.gz "${JAVA_PKG}"
mkdir -p "${JAVA_HOME}"
tar --extract --file /tmp/jdk.tar.gz --directory "${JAVA_HOME}" --strip-components 1
fi

# Validate java is available in the runner.
java -version
2 changes: 1 addition & 1 deletion .buildkite/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
agents:
provider: "gcp"
#image: "family/apm-agent-java-ubuntu-2204"
image: "family/apm-agent-java-ubuntu-2204"

steps:
- label: "Run the release"
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
agents:
provider: "gcp"
#image: "family/apm-agent-java-ubuntu-2204"
image: "family/apm-agent-java-ubuntu-2204"

steps:
- label: "Run the snapshot"
Expand Down
Loading