Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,42 @@ echo "--- Configure git context :git:"
git config --global user.email "infra-root+apmmachine@elastic.co"
git config --global user.name "apmmachine"

echo "--- Install JDK11"
JAVA_URL=https://jvm-catalog.elastic.co/jdk
JAVA_HOME=$(pwd)/.openjdk11
JAVA_PKG="$JAVA_URL/latest_openjdk_11_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
export PATH=$JAVA_HOME/bin:$PATH
PATH="${JAVA_HOME}/bin:$PATH"
export PATH

echo "--- Install Android SDK"
# Configure Android SDK using the script
./install-android-sdk.sh
export PATH=${PATH}:$PWD/.android-sdk/tools/bin/
export ANDROID_HOME=$PWD/.android-sdk
# Fallback to install at runtime
if [ ! -d "${JAVA_HOME}" ] ; then
# 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

export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
# Configure the Android SDK
ANDROID_HOME="${PWD}/.android-sdk"
PATH="${PATH}:${ANDROID_HOME}/tools/bin"
export ANDROID_HOME
export PATH

java -version || true
# Fallback to install at runtime
if [ ! -d "${ANDROID_HOME}" ] ; then
# This should not be the case normally.
echo "--- Install Android SDK"
./install-android-sdk.sh
fi

# Validate java is installed
echo "--- Validate java is installed :java:"
java -version

# Validate Android SDK is installed
echo "--- Validate Android SDK :android:"
sdkmanager --list
1 change: 1 addition & 0 deletions .buildkite/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
agents:
provider: "gcp"
image: "family/apm-agent-android-ubuntu-2204"

steps:
- label: "Run the release"
Expand Down
18 changes: 10 additions & 8 deletions .ci/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@ set +x
export COMMON_GRADLE_DEPLOY_PARAMS="-Prelease=true -Pversion_override=${version_override_specifier} --stacktrace"

if [[ "$target_specifier" == "all" || "$target_specifier" == "mavenCentral" ]]; then
echo "--- Release the binaries to Maven Central"
if [[ "$dry_run" == "true" ]] ; then
echo './gradlew publishElasticPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository'
else
if [[ "$dry_run" == "false" ]] ; then
echo "--- Release the binaries to Maven Central"
./gradlew publishElasticPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository $COMMON_GRADLE_DEPLOY_PARAMS
else
echo "--- Release the binaries to Maven Central :package: (dry-run)"
./gradlew tasks
fi
fi

if [[ "$target_specifier" == "all" || "$target_specifier" == "pluginPortal" ]]; then
echo "--- Release the binaries to the Gradle Plugin portal"
if [[ "$dry_run" == "true" ]] ; then
echo './gradlew publishPlugins'
else
if [[ "$dry_run" == "false" ]] ; then
echo "--- Release the binaries to the Gradle Plugin portal"
./gradlew publishPlugins -Pgradle.publish.key=$PLUGIN_PORTAL_KEY -Pgradle.publish.secret=$PLUGIN_PORTAL_SECRET $COMMON_GRADLE_DEPLOY_PARAMS
else
echo "--- Release the binaries to Gradle Plugin portal :package: (dry-run)"
./gradlew tasks
fi
fi
set -x
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,22 @@ jobs:
with:
needs: ${{ toJSON(needs) }}
- run: ${{ steps.check.outputs.isSuccess }}

test-release:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- id: buildkite
name: Run Release dry-run
uses: elastic/apm-pipeline-library/.github/actions/buildkite@current
with:
vaultUrl: ${{ secrets.VAULT_ADDR }}
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
pipeline: apm-agent-android-release
waitFor: true
printBuildLogs: false
buildEnvVars: |
branch_specifier=main
target_specifier=all
dry_run=true
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11