Skip to content

Main to 0.x #287

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

Merged
merged 25 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7e1dcad
Bump the github-actions group with 1 update (#250)
dependabot[bot] Dec 18, 2023
0d78519
Add sample app (#249)
LikeTheSalad Dec 19, 2023
f2264ed
ci(release): use new set of credentials for GPG and Maven Central (#255)
v1v Jan 16, 2024
5c9059a
ci(buildkite): vault context switch (#256)
v1v Jan 16, 2024
c00c4a3
Revert "Bump the github-actions group with 1 update" (#257)
v1v Jan 16, 2024
75a38a8
ci(release): use the new vault secret path (#258)
v1v Jan 17, 2024
ed1a6dc
ci(release): fetch field in plain format (#259)
v1v Jan 17, 2024
dbd3b99
Sim operator fix (#261)
LikeTheSalad Jan 18, 2024
b8ad9ba
Using short key id (#262)
LikeTheSalad Jan 18, 2024
6ff031f
Release 0.13.1 (#263)
apmmachine Jan 18, 2024
152a295
backstage: add tags for the obltmachine/apmmachine and other things (…
v1v Jan 26, 2024
3761997
Release/0.14.0 (#267)
LikeTheSalad Feb 2, 2024
947da73
Preparing for the next release (#268)
apmmachine Feb 2, 2024
2f9cf82
Updated the changelog (#269)
LikeTheSalad Feb 2, 2024
beeb312
Make resources configurable (#276)
LikeTheSalad Mar 11, 2024
d839f8e
ci: use VM with the installed tools and fallback otherwise (#274)
v1v Mar 11, 2024
ced2449
Preparing for the next release (#277)
apmmachine Mar 12, 2024
28d4cf9
github-action: listen for all the github workflows (#279)
v1v Mar 13, 2024
74cda37
security: add permissions block to workflows (#272)
reakaleek Mar 13, 2024
16eee2d
Documentation update (#281)
LikeTheSalad Mar 14, 2024
bf755f0
Cicd version validation (#282)
LikeTheSalad Mar 14, 2024
77ea42a
Updating setup doc versions in post deploy process (#283)
LikeTheSalad Mar 14, 2024
f33bb63
Cicd release messages update (#284)
LikeTheSalad Mar 14, 2024
561606a
Github action to automatically update version branch after a release …
LikeTheSalad Mar 14, 2024
8f3122a
Merge branch 'main' into main-to-0x
LikeTheSalad Mar 14, 2024
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
3 changes: 3 additions & 0 deletions .github/workflows/addToProject.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
env:
MY_GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }}

permissions:
contents: read

jobs:
assign_one_project:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
types: [opened]
env:
MY_GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }}
permissions:
contents: read
issues: write
pull-requests: write

jobs:
triage:
runs-on: ubuntu-latest
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/opentelemetry.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
# Look up results at https://ela.st/oblt-ci-cd-stats
# There will be one service per GitHub repository, including the org name, and one Transaction per Workflow.
name: OpenTelemetry Export Trace

on:
workflow_run:
workflows:
- Continous Integration
- release
- snapshoty
- test-reporter
workflows: [ "*" ]
types: [completed]

permissions:
contents: read

jobs:
otel-export-trace:
runs-on: ubuntu-latest
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- id: notification
name: Notify that a release will start
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
with:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
channel: "#apm-agent-mobile"
message: |
:runner: [${{ github.repository }}] Release *${{ github.ref_name }}* has been triggered with the following params:
```${{ toJSON(github.event.inputs) }}```

- id: buildkite
name: Run Release
uses: elastic/apm-pipeline-library/.github/actions/buildkite@current
Expand All @@ -64,7 +76,7 @@ jobs:
secretId: ${{ secrets.VAULT_SECRET_ID }}
channel: "#apm-agent-mobile"
message: |
:runner: [${{ github.repository }}] Release *${{ github.ref_name }}* has been triggered in Buildkite: (<${{ steps.buildkite.outputs.build }}|build>)
:tada: :rocket: [${{ github.repository }}] Release *${{ github.ref_name }}* has been successful in Buildkite: (<${{ steps.buildkite.outputs.build }}|build>)

- if: ${{ failure() }}
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-reporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
types:
- completed

permissions:
contents: read
actions: read
checks: write

jobs:
report:
runs-on: ubuntu-latest
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/updateVersionBranch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Update version branch

#When a release is done, this creates a PR from main to the released version branch to keep it updated.
#For example, if version "0.1.0" is released off of the main branch, then a PR from "main" to "0.x" will be created right after the release post-deploy is done.

on:
pull_request:
types:
- closed

permissions:
contents: read

jobs:
if_merged_postDeploy:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'post-release/')
runs-on: ubuntu-latest
name: Create PR to update version branch
steps:
- uses: elastic/apm-pipeline-library/.github/actions/github-token@current
with:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
- uses: elastic/apm-pipeline-library/.github/actions/setup-git@current
with:
username: ${{ env.GIT_USER }}
email: ${{ env.GIT_EMAIL }}
token: ${{ env.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- uses: actions-ecosystem/action-regex-match@v2
id: major-version
with:
text: ${{ github.event.pull_request.head.ref }}
regex: 'post-release/(\d+).+'

- run: gh pr create --base ${{ env.BASE_BRANCH }} --title 'Merge main into version branch' --body 'Created by Github action' --reviewer elastic/apm-agent-android
env:
GH_TOKEN: ${{ env.GITHUB_TOKEN }}
BASE_BRANCH: "${{ steps.major-version.outputs.group1 }}.x"
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.PluginContainer;
import org.gradle.util.internal.VersionNumber;

import java.time.Duration;
import java.util.regex.Pattern;

import co.elastic.apm.compile.tools.NoticeProviderPlugin;
import co.elastic.apm.compile.tools.plugins.RootNoticeProviderPlugin;
Expand Down Expand Up @@ -35,12 +37,29 @@ public void apply(Project project) {
private void configureVersion(Project project) {
String versionOverride = getVersionOverride(project);
if (versionOverride != null) {
validateVersionOverrideFormatting(versionOverride);
validateVersionPatchChangeOnly(project.getVersion().toString(), versionOverride);
System.out.println("Overriding version with: '" + versionOverride + "'");
project.setVersion(versionOverride);
project.subprojects(subproject -> subproject.setVersion(versionOverride));
}
}

private static void validateVersionPatchChangeOnly(String currentVersion, String versionOverride) {
VersionNumber comparableVersion = VersionNumber.parse(currentVersion);
VersionNumber comparableVersionOverride = VersionNumber.parse(versionOverride);
if (comparableVersionOverride.getMajor() > comparableVersion.getMajor() || comparableVersionOverride.getMinor() > comparableVersion.getMinor()) {
throw new IllegalArgumentException(String.format("The version override, '%s', cannot provide greater major or minor numbers than the existing version from the gradle.properties file: '%s'.", versionOverride, currentVersion));
}
}

private static void validateVersionOverrideFormatting(String versionOverride) {
Pattern semverPattern = Pattern.compile("\\d+\\.\\d+\\.\\d+");
if (!semverPattern.matcher(versionOverride).matches()) {
throw new IllegalArgumentException(String.format("The provided version override, '%s', does not have a valid format.", versionOverride));
}
}

private String getVersionOverride(Project project) {
if (!project.hasProperty(PROPERTY_VERSION_OVERRIDE)) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void execute() {

updateNextVersion(gradlePropertiesFile, properties, newVersion);
updateChangelog(currentVersion);
updateSetupDoc(currentVersion);

createPullRequestWithChanges(currentVersion);
setGitHubRelease(currentVersion, releaseTag);
Expand Down Expand Up @@ -85,12 +86,23 @@ private void updateNextVersion(File gradlePropertiesFile, Properties properties,

private void updateChangelog(String newVersion) {
log("Updating changelog with version: " + newVersion);
Path changelogPath = getChangelogPath();
Path changelogPath = getProjectPath("CHANGELOG.asciidoc");
String contents = getContents(changelogPath);
contents = uncommentNextRelease(contents);
replaceFileContents(changelogPath, resolvePlaceholders(contents, newVersion));
}

private void updateSetupDoc(String currentVersion) {
log("Updating setup doc to show version: " + currentVersion);
Path setupDocPath = getProjectPath("docs/setup.asciidoc");
String contents = getContents(setupDocPath);
Pattern versionMentionsPattern = Pattern.compile("(?<=co\\.elastic\\.apm\\.android/)\\d+\\.\\d+\\.\\d+|(?<=co\\.elastic\\.apm:android-sdk:)\\d+\\.\\d+\\.\\d+|(?<=id\\s\"co\\.elastic\\.apm\\.android\"\\sversion\\s\")\\d+\\.\\d+\\.\\d+");
Matcher versionMentionMatcher = versionMentionsPattern.matcher(contents);

String setupDocWithNewVersion = versionMentionMatcher.replaceAll(currentVersion);
replaceFileContents(setupDocPath, setupDocWithNewVersion.getBytes(StandardCharsets.UTF_8));
}

private byte[] resolvePlaceholders(String text, String newVersion) {
Map<String, String> substitutions = new HashMap<>();
substitutions.put("release_date", new SimpleDateFormat("yyyy/MM/dd", Locale.US).format(new Date()));
Expand All @@ -100,8 +112,8 @@ private byte[] resolvePlaceholders(String text, String newVersion) {
return substitutor.replace(text).getBytes(StandardCharsets.UTF_8);
}

private Path getChangelogPath() {
File changelog = new File("CHANGELOG.asciidoc");
private Path getProjectPath(String relativePath) {
File changelog = new File(relativePath);
return changelog.toPath();
}

Expand Down
12 changes: 4 additions & 8 deletions docs/setup.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@ You can skip this step if your `minSdkVersion` is 26 or higher.
[[adding-gradle-plugin]]
==== Add the Elastic Agent Gradle plugin

To automatically instrument <<supported-technologies,Supported Technologies>>, add the https://plugins.gradle.org/plugin/co.elastic.apm.android[Elastic APM agent plugin] to your application's `build.gradle` file as shown below:
To automatically instrument <<supported-technologies,Supported Technologies>>, add the https://plugins.gradle.org/plugin/co.elastic.apm.android/0.15.0[Elastic APM agent plugin] to your application's `build.gradle` file as shown below:

[source,groovy]
----
// Android app's build.gradle file
plugins {
id "com.android.application"
id "co.elastic.apm.android" version "[latest_version]" <1>
id "co.elastic.apm.android" version "0.15.0"
}
----

<1> The Elastic plugin declaration must be added below the Android app plugin declaration (`com.android.application`) and below the Kotlin plugin declaration (if used).

After adding the agent plugin, configure it.
A minimal configuration sets the Elastic APM Server endpoint as shown below:

Expand Down Expand Up @@ -118,18 +116,16 @@ If you can't add the Elastic Agent Gradle plugin to your application as shown ab
[[gradle-dependencies]]
==== Add the SDK dependency

Add the https://central.sonatype.com/artifact/co.elastic.apm/android-sdk[Elastic APM agent SDK] to your application's `build.gradle` file as shown below:
Add the Elastic APM agent SDK to your application's `build.gradle` file as shown below:

[source,groovy]
----
// Android app's build.gradle file
dependencies {
implementation "co.elastic.apm:android-sdk:[latest_version]" <1>
implementation "co.elastic.apm:android-sdk:0.15.0"
}
----

<1> You can find the latest version https://central.sonatype.com/artifact/co.elastic.apm/android-sdk[here].

[float]
[[manual-configuration]]
==== Configure your app's info and connectivity parameters
Expand Down