Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e61a8fc
[maven-release-plugin] prepare for next development iteration
Mar 6, 2024
c7f7f2c
Update cloudfoundry for 1.48.1 release
Mar 6, 2024
72a74e5
ci: use .java-version and prepare to use VM with installed tools in B…
v1v Mar 11, 2024
6d111e8
ci(bk): use specialised VMs (#3555)
v1v Mar 11, 2024
9a97f78
Added a note on centralized agent config support for AWS Lambda (#3498)
someshwaranM Mar 11, 2024
cb50984
Bump com.networknt:json-schema-validator from 1.1.0 to 1.3.3 (#3547)
dependabot[bot] Mar 11, 2024
6d4b20e
Fix inheritance for API annotations (#3551)
JonasKunz Mar 11, 2024
c5ed2e1
powershell no-logo (#3556)
SylvainJuge Mar 11, 2024
f45c746
security: add permissions block to workflows (#3531)
reakaleek Mar 12, 2024
dfa9519
Bump io.micrometer:micrometer-core from 1.12.2 to 1.12.4 (#3559)
dependabot[bot] Mar 12, 2024
d8ae52b
Bump version.log4j from 2.12.4 to 2.23.1 (#3557)
dependabot[bot] Mar 12, 2024
464b9c1
Add API for instrumenting FAAS and adjust the AWS plugin (#3516)
raphw Mar 12, 2024
4858631
Introduce API for metrics collection that does not depend on agent-co…
raphw Mar 12, 2024
3c4a753
differentiate Lambda url from api gateway (#3417)
videnkz Mar 13, 2024
3b22aad
added support to Elastic Load Balancer triggers (#3411)
videnkz Mar 13, 2024
6c673b8
feat: new release process with PRs (#3567)
amannocci Mar 25, 2024
5b67924
Bump version.aws.sdk from 2.25.0 to 2.25.21 in /apm-agent-plugins (#3…
dependabot[bot] Apr 2, 2024
a10ecd4
Bump org.awaitility:awaitility from 4.2.0 to 4.2.1 (#3573)
dependabot[bot] Apr 2, 2024
2e1bce7
Add exclusion list option for calling DatabaseMetaData.getUserName (#…
jackshirazi Apr 2, 2024
a3709b7
pre release: elastic-apm-agent v1.49.0 (#3576)
Apr 2, 2024
3059907
ci(fix): use input value instead of env value for post release trigge…
amannocci Apr 2, 2024
1a17acb
ci(fix): correct buildkite pipeline trigger (#3578)
amannocci Apr 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
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)
32 changes: 21 additions & 11 deletions .buildkite/hooks/prepare-common.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail

echo "--- Install JDK17 :java:"
# JDK version is defined in two different locations, here and .github/workflows/maven-goal/action.yml
JAVA_URL=https://jvm-catalog.elastic.co/jdk
JAVA_HOME=$(pwd)/.openjdk17
JAVA_PKG="$JAVA_URL/latest_openjdk_17_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

# Configure the java version
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

java -version || true
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
fi

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

steps:
- label: "Run the release"
Expand All @@ -11,4 +12,5 @@ steps:

notify:
- slack: "#apm-agent-java"
if: 'build.state != "passed"'
# skip slack messages if no failures and dry-run mode
if: 'build.state != "passed" && build.env("dry_run") == "false"'
4 changes: 3 additions & 1 deletion .buildkite/snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
agents:
provider: "gcp"
image: "family/apm-agent-java-ubuntu-2204"

steps:
- label: "Run the snapshot"
Expand All @@ -11,4 +12,5 @@ steps:

notify:
- slack: "#apm-agent-java"
if: 'build.state != "passed"'
# skip slack messages if no failures and dry-run mode
if: 'build.state != "passed" && build.env("dry_run") == "false"'
13 changes: 11 additions & 2 deletions .ci/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,14 @@ echo $PATH
java -version

set +x
echo "--- Deploy the release :package:"
./mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode | tee release.txt
# Default in dry-run mode
GOAL="install"
DRY_RUN_MSG="(dry-run)"
# Otherwise, a RELEASE
if [[ "$dry_run" == "false" ]] ; then
GOAL="deploy"
DRY_RUN_MSG=""
fi

echo "--- Deploy the release :package: [./mvnw $GOAL)] $DRY_RUN_MSG"
./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee release.txt
31 changes: 31 additions & 0 deletions .ci/release/post-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# Bash strict mode
set -euo pipefail

# Found current script directory
RELATIVE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# Found project directory
BASE_PROJECT="$(dirname $(dirname "${RELATIVE_DIR}"))"

# Import dependencies
source "${RELATIVE_DIR}/util.sh"

# Constants
BASE_URL="https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent"
CF_FILE="${BASE_PROJECT}/cloudfoundry/index.yml"

# Requirements
check_version "${RELEASE_VERSION}"

echo "Set next snapshot version"
./mvnw -V versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -DnextSnapshot=true

# make script idempotent if release is already in CF descriptor
set +e
grep -e "^${RELEASE_VERSION}:" ${CF_FILE}
[[ $? == 0 ]] && exit 0
set -e
echo "Update cloudfoundry version"
echo "${RELEASE_VERSION}: ${BASE_URL}/${RELEASE_VERSION}/elastic-apm-agent-${RELEASE_VERSION}.jar" >> "${CF_FILE}"
22 changes: 22 additions & 0 deletions .ci/release/pre-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Bash strict mode
set -euo pipefail

# Found current script directory
RELATIVE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# Found project directory
BASE_PROJECT="$(dirname $(dirname "${RELATIVE_DIR}"))"

# Import dependencies
source "${RELATIVE_DIR}/util.sh"

# Requirements
check_version "${RELEASE_VERSION}"

echo "Set release version"
./mvnw -V versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -DnewVersion="${RELEASE_VERSION}"

echo "Prepare changelog for release"
java "${BASE_PROJECT}/.ci/ReleaseChangelog.java" CHANGELOG.asciidoc "${RELEASE_VERSION}"
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,10 @@ git checkout --force ${checkout_options}

echo -e "\n--- move local branch ${major_branch} to match tag ${tag}"
git reset --hard ${tag}

echo -e "\n--- create new branch with updates"
git checkout -b "update-major-${v}"
git push origin "update-major-${v}"

echo -e "\n--- create PR to update major branch"
gh pr create --title="post release v${v}: update major branch" --base "${major_branch}" --head "update-major-${v}" -b "post release v${v}"
28 changes: 0 additions & 28 deletions .ci/release/update_cloudfoundry.sh

This file was deleted.

10 changes: 4 additions & 6 deletions .ci/release/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
check_version() {
v=${1:-}

if [[ "${v}" == "" ]]; then
echo "usage $0 <version>" # here $0 will be the calling script
echo "where <version> in format '1.2.3'"
if [ -z "${v}" ]; then
>&2 echo "The environment variable 'RELEASE_VERSION' isn't defined"
exit 1
fi

if [[ ! "$v" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "invalid version format '${v}'"
if [[ ! "${v}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
>&2 echo "The environment variable 'RELEASE_VERSION' should respect SemVer format"
exit 1
fi
}
Expand Down
13 changes: 0 additions & 13 deletions .ci/release/wait_maven_artifact_published.sh

This file was deleted.

15 changes: 10 additions & 5 deletions .ci/snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ echo $PATH
java -version

set +x
echo "--- Deploy the snapshot :package:"
if [[ "$dry_run" == "true" ]] ; then
echo './mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode'
else
./mvnw -V -s .ci/settings.xml -Pgpg clean deploy -DskipTests --batch-mode | tee snapshot.txt
# Default in dry-run mode
GOAL="install"
DRY_RUN_MSG="(dry-run)"
# Otherwise, a snapshot
if [[ "$dry_run" == "false" ]] ; then
GOAL="deploy"
DRY_RUN_MSG=""
fi

echo "--- Deploy the snapshot :package: [./mvnw $GOAL)] $DRY_RUN_MSG"
./mvnw -V -s .ci/settings.xml -Pgpg clean $GOAL -DskipTests --batch-mode | tee snapshot.txt
6 changes: 5 additions & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ Every time there is a merge to main or any branches the whole workflow will comp

### Release process

This process has been fully automated and it gets triggered manually when running the [release](https://github.com/elastic/apm-agent-java/actions/workflows/release.yml) workflow. It runs then a Buildkite pipeline in charge of generating and publishing the artifacts,
To release a new version of apm-agent-java, you must use the two GitHub Workflows.
Trigger the `Pre Release` workflow targeting the release version.
After merging the PRs created by the first workflow, you can trigger the `Release` workflow targeting the release version.
It runs then a Buildkite pipeline in charge of generating and publishing the artifacts,
for further details please go to [the buildkite folder](../../.buildkite/README.md).
Finally, merge the PRs created to bump version for the next iteration.

The tag release follows the naming convention: `v.<major>.<minor>.<patch>`, where `<major>`, `<minor>` and `<patch>`.

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/addToProject.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
issues:
types:
- opened, milestoned
permissions:
contents: read

jobs:
add_to_project:
if: github.event.issue && github.event.issue.milestone
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
pull_request_target:
types: [opened]

permissions:
contents: read
issues: write
pull-requests: write

jobs:
triage:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ jobs:
distribution: 'temurin'
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/maven-goal
- uses: ./.github/workflows/maven-goal-jdk
with:
test-java-version: ${{ matrix.version }}
test-java-distribution: ${{ matrix.distribution }}
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/maven-goal-jdk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---

name: common build tasks
description: Install specific JDK and run a command

inputs:
test-java-version:
description: 'Testing Java version'
required: true
default: '17'
test-java-distribution:
description: 'Testing Java distribution'
required: true
default: 'temurin'
command:
description: 'Command to execute'
required: true
shell:
description: 'Default shell'
default: 'bash'
required: false

runs:
using: "composite"
steps:
- name: Set up testing JDK
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.test-java-version}}
distribution: ${{ inputs.test-java-distribution}}

- name: Set up TEST_JAVA_BINARY environment variable
shell: bash
run: |
major_version="$(echo '${{ inputs.test-java-version }}' | sed 's/\([0-9]*\).*/\1/')"
java_home_var=JAVA_HOME_${major_version}_${{ runner.arch }}
echo "TEST_JAVA_BINARY=${!java_home_var}/bin/java" >> $GITHUB_ENV

- uses: ./.github/workflows/maven-goal
with:
command: ${{ inputs.command }}
shell: ${{ inputs.shell }}
env:
TEST_JAVA_BINARY: ${{ env.TEST_JAVA_BINARY }}
22 changes: 1 addition & 21 deletions .github/workflows/maven-goal/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ name: common build tasks
description: Install specific JDK and run a command

inputs:
test-java-version:
description: 'Testing Java version'
required: true
default: '17'
test-java-distribution:
description: 'Testing Java distribution'
required: true
default: 'temurin'
command:
description: 'Command to execute'
required: true
Expand All @@ -23,23 +15,11 @@ inputs:
runs:
using: "composite"
steps:
- name: Set up testing JDK
if: ${{ inputs.test-java-version != '17' }}
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.test-java-version}}
distribution: ${{ inputs.test-java-distribution}}
- name: Set up build JDK
uses: actions/setup-java@v4
with:
java-version: 17 # NOTE: This version is also defined in .buildkite/hooks/pre-command
java-version-file: .java-version
distribution: temurin
cache: 'maven'
- name: Set up TEST_JAVA_BINARY environment variable
shell: bash
run: |
major_version="$(echo '${{ inputs.test-java-version }}' | sed 's/\([0-9]*\).*/\1/')"
java_home_var=JAVA_HOME_${major_version}_${{ runner.arch }}
echo "TEST_JAVA_BINARY=${!java_home_var}/bin/java" >> $GITHUB_ENV
- run: ${{ inputs.command }}
shell: ${{ inputs.shell }}
Loading