Skip to content

Commit 541e0a0

Browse files
committed
JAVA-5415: add artifact tracing on publish
This commit adds papertrail tracing on release to all modules we release. This tracing will run on every snapshot and release. The change to publish.gradle was done because the publish plugin by default does not write generated pom files or their signatures to with the same name that they are pushed to the remote repository with. Instead of capturing "pom-default.xml" in Papertrail (the default name on disk), we want to use the name it was published with. The afterEvaluate command included will re-construct the generated name for each module in the project and write that to disk instead. We can then glob these files based on their extension just like the jar files.
1 parent c8ce9ae commit 541e0a0

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

.evergreen/.evg.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,37 @@ functions:
821821
822822
MONGODB_URI="${MONGODB_URI}" JAVA_VERSION="${JAVA_VERSION}" .evergreen/run-csfle-tests-with-mongocryptd.sh
823823
824+
"trace artifacts":
825+
- command: shell.exec
826+
params:
827+
working_dir: "src"
828+
script: |
829+
tag=$(git describe --tags --always --dirty)
830+
831+
# remove the leading 'r'
832+
version=$(echo -n "$tag" | cut -c 2-)
833+
834+
cat <<EOT > trace-expansions.yml
835+
release_version: "$version"
836+
EOT
837+
cat trace-expansions.yml
838+
839+
ls -lisah bson-kotlin/build/libs
840+
- command: expansions.update
841+
params:
842+
file: src/trace-expansions.yml
843+
- command: papertrail.trace
844+
params:
845+
key_id: ${papertrail_key_id}
846+
secret_key: ${papertrail_secret_key}
847+
product: ${product}
848+
version: ${release_version}
849+
filenames:
850+
- "src/*/build/libs/*.jar"
851+
- "src/*/build/libs/*.asc"
852+
- "src/*/build/publications/mavenJava/*.pom"
853+
- "src/*/build/publications/mavenJava/*.asc"
854+
824855
"publish snapshot":
825856
- command: shell.exec
826857
type: test
@@ -1491,11 +1522,17 @@ tasks:
14911522
name: "static-analysis"
14921523
commands:
14931524
- func: "publish snapshot"
1525+
- func: "trace artifacts"
1526+
vars:
1527+
product: mongo-java-driver-snapshot
14941528

14951529
- name: publish-release
14961530
git_tag_only: true
14971531
commands:
14981532
- func: "publish release"
1533+
- func: "trace artifacts"
1534+
vars:
1535+
product: mongo-java-driver
14991536

15001537
- name: "perf"
15011538
tags: ["perf"]

gradle/publish.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ def scalaProjects = publishedProjects.findAll { it.name.contains('scala') }
7474
def javaProjects = publishedProjects - scalaProjects
7575
def projectsWithManifest = publishedProjects.findAll {it.name != 'driver-legacy' }
7676

77+
configure(publishedProjects) { project ->
78+
afterEvaluate {
79+
generatePomFileForMavenJavaPublication.destination = "build/publications/mavenJava/" +
80+
project.archivesBaseName + "-" + version + "." + "pom"
81+
}
82+
}
83+
7784
configure(javaProjects) { project ->
7885
apply plugin: 'maven-publish'
7986
apply plugin: 'signing'

0 commit comments

Comments
 (0)