Skip to content
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

fix: fixed the profile for Artifact Registry deployment #950

Merged
merged 1 commit into from
Dec 10, 2024
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
12 changes: 0 additions & 12 deletions java-shared-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -381,18 +381,6 @@
</executions>
</plugin>
</plugins>
<extensions>
<extension>
<!--
Enables the "artifactregistry://" URL scheme (go/airlock/howto_maven).
Note that Maven extensions cannot be included in profiles (
https://maven.apache.org/guides/introduction/introduction-to-profiles.html#profiles-in-poms)
-->
<groupId>com.google.cloud.artifactregistry</groupId>
<artifactId>artifactregistry-maven-wagon</artifactId>
<version>2.2.3</version>
</extension>
</extensions>
</build>

<reporting>
Expand Down
60 changes: 54 additions & 6 deletions native-image-shared-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,62 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
</plugin>
</plugins>
<extensions>
<extension>
<!--
Enables the "artifactregistry://" URL scheme (go/airlock/howto_maven).
Note that Maven extensions cannot be included in profiles (
https://maven.apache.org/guides/introduction/introduction-to-profiles.html#profiles-in-poms)
-->
<groupId>com.google.cloud.artifactregistry</groupId>
<artifactId>artifactregistry-maven-wagon</artifactId>
<version>2.2.3</version>
</extension>
</extensions>
</build>
<profiles>
<profile>
<!-- By default, we release artifacts to Sonatype, which requires
nexus-staging-maven-plugin. -->
<id>release-sonatype</id>
<activation>
<property>
<!-- Only when we use the release-gcp-artifact-registry profile,
which comes with artifact-registry-url property, this profile is
turned off. -->
<name>!artifact-registry-url</name>
Copy link
Member

@burkedavison burkedavison Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's possible to chain profile activations/deactivations like this.

https://stackoverflow.com/a/2248552

Are you able to verify this works?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not chaining profile activation (this is not relying on the line 145).

This activation relies on the fact that when we publish artifacts to GCP Artifact Registry using release-gcp-artifact-registry profile, -Dartifact-registry-url=... is always passed to the mvn command.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll verify it works in the Kokoro release job.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have line 145, then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 145 is dummy value that tells the property is undefined.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll verify it works in the Kokoro release job.

The release of this repository and google-auth-library-java (googleapis/google-auth-library-java#1593) succeeded.

</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- Optionally, we can publish the artifacts to GCP Artifact Registry specifying
this release-gcp-artifact-registry profile:
mvn deploy -P=release-gcp-artifact-registry -P=-release-sonatype \
-Dartifact-registry-url=artifactregistry://us-maven.pkg.dev/...
-->
<id>release-gcp-artifact-registry</id>
<properties>
<artifact-registry-url>artifactregistry://undefined-artifact-registry-url-value</artifact-registry-url>
</properties>
<distributionManagement>
<repository>
<id>gcp-artifact-registry-repository</id>
<url>${artifact-registry-url}</url>
</repository>
<snapshotRepository>
<id>gcp-artifact-registry-repository</id>
<url>${artifact-registry-url}</url>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>release</id>
<activation>
Expand Down
Loading