Skip to content
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
40 changes: 9 additions & 31 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build

on:
push:
branches: '**'
branches: master
tags: 'v*'
pull_request:
branches: '**'
Expand Down Expand Up @@ -47,6 +47,14 @@ jobs:
-Psigning.keyId=4FB80B8E \
-PsonatypeUsername=${{ secrets.SONATYPE_USER }} \
-PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }}
- name: Push Docker Image to DockerHub
if: startsWith(github.ref, 'refs/tags/v')
run: |
./gradlew :agent:pushOciImage :agent:pushLegacyOciImage --registry=dockerHub
./gradlew :agent:pushOciImage :agent:pushLegacyOciImage --registry=dockerHub -PociImageTag=latest
env:
ORG_GRADLE_PROJECT_dockerHubUsername: ${{ secrets.DOCKERHUB_USER }}
ORG_GRADLE_PROJECT_dockerHubPassword: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Upload coverage to Teamscale
if: always() && github.event_name == 'push'
uses: cqse/teamscale-upload-action@v9.2.1
Expand Down Expand Up @@ -83,33 +91,3 @@ jobs:
format: 'JACOCO'
message: 'Coverage Windows'
files: '**/jacocoTestReport.xml'

docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: cqse/teamscale-jacoco-agent
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v7
with:
file: 'agent/src/docker/Dockerfile'
platforms: linux/amd64,linux/arm64
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GITHUB_REF=${{ github.ref }}

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ We use [semantic versioning](http://semver.org/):
- PATCH version when you make backwards compatible bug fixes.

# Next version
- [feature] _agent_: Renamed the docker image to `cqse/teamscale-java-profiler` and added support for the `linux/arm64` platform

# 36.4.1
- [fix] _agent_: Fixed `IllegalStateException: Can't add different class with same name` when application servers like JBoss perform a reload without full restart or when duplicate class files exist across multiple archives
Expand Down
57 changes: 57 additions & 0 deletions agent/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import io.github.sgtsilvio.gradle.oci.dsl.OciImageDefinition

plugins {
com.teamscale.`java-convention`
application
Expand All @@ -9,6 +11,7 @@ plugins {
com.teamscale.coverage
com.teamscale.publish
com.teamscale.`logger-patch`
alias(libs.plugins.oci)
}

evaluationDependsOn(":installer")
Expand Down Expand Up @@ -101,3 +104,57 @@ distributions {
tasks.shadowDistZip {
archiveFileName = "teamscale-jacoco-agent.zip"
}

// The OCI plugin adds a project-level repository ('dockerHubOciRegistry') for resolving
// OCI image dependencies, which overrides the settings-level dependencyResolutionManagement
// repositories. We need to re-declare mavenCentral() here so regular dependencies can still
// be resolved. See: https://github.com/SgtSilvio/gradle-oci/issues/125
repositories {
mavenCentral()
}

oci {
registries {
dockerHub {
optionalCredentials()
}
}

val ociImageTag = providers.gradleProperty("ociImageTag").orElse(appVersion)
val configureImage: Action<OciImageDefinition> = Action {
imageTag = ociImageTag
allPlatforms {
dependencies {
runtime("library:alpine:latest")
}
config {
entryPoint = listOf("/entrypoint.sh")
}
layer("agent") {
contents {
into("agent") {
from(tasks.shadowJar)
}
}
}
layer("entrypoint") {
contents {
from("src/docker/entrypoint.sh") {
filePermissions = "755".toInt(8)
}
}
}
}
specificPlatform(platform("linux", "amd64"))
Comment thread
stahlbauer marked this conversation as resolved.
specificPlatform(platform("linux", "arm64"))
}

imageDefinitions.register("main") {
imageName = "cqse/teamscale-java-profiler"
configureImage.execute(this)
}
imageDefinitions.register("legacy") {
imageName = "cqse/teamscale-jacoco-agent"
configureImage.execute(this)
}
}
35 changes: 0 additions & 35 deletions agent/src/docker/Dockerfile

This file was deleted.

11 changes: 11 additions & 0 deletions agent/src/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# When /transfer exists (shared volume), copy the agent JAR there and exit.
# This supports the Kubernetes init container pattern where this image provides
# the agent JAR to the application container via a shared volume.
if [ -e /transfer ]; then
Comment thread
DreierF marked this conversation as resolved.
cp -r /agent/teamscale-jacoco-agent.jar /transfer
exit 0
fi
# Otherwise, keep the container alive indefinitely as a sidecar.
trap : TERM INT
sleep infinity & wait
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ pluginPublish = { id = "com.gradle.plugin-publish", version = "2.1.1" }
gitProperties = { id = "com.gorylenko.gradle-git-properties", version = "2.5.7" }
mavenPluginDevelopment = { id = "org.gradlex.maven-plugin-development", version = "1.0.3" }
shadow = { id = "com.gradleup.shadow", version = "9.4.1" }
oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.25.0" }
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version = "2.3.20" }
jlink = { id = "org.beryx.jlink", version = "4.0.0" }
Loading