Skip to content

Commit 3424cb5

Browse files
authored
ci: allow nonexistent profile in google-cloud-bigtable (#2611)
Our new release job script specifies profiles that might not exist in all Java projects in our release pipeline. The requireProfileIdsExist enforcer rule fails in that case. ``` [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.5.0:enforce (enforce-valid-profile) on project google-cloud-bigtable: [ERROR] Rule 0: org.apache.maven.enforcer.rules.RequireProfileIdsExist failed with message: [ERROR] The requested profile doesn't exist: release-staging-repository ``` Therefore, let's disable the requireProfileIdsExist rule during the release. This change created a profile that does that: ``` <profile> <id>enable-enforcer-rules</id> <activation> <property> <!-- By default, Maven runs the enforcer rules. The shared release script may pass profile name that doesn't exist in this project. Let's ignore the enforcer rule (requireProfileIdsExist) in that case, leveraging the presence of the performRelease property. --> <name>!performRelease</name> </property> ... ```
1 parent 9096e70 commit 3424cb5

File tree

2 files changed

+65
-49
lines changed

2 files changed

+65
-49
lines changed

google-cloud-bigtable/pom.xml

Lines changed: 63 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,69 @@
349349
</dependencies>
350350

351351
<profiles>
352+
<profile>
353+
<id>enable-enforcer-rules</id>
354+
<activation>
355+
<property>
356+
<!-- By default, Maven runs the enforcer rules. The shared release script
357+
may pass profile name that doesn't exist in this project. Let's ignore
358+
the enforcer rule (requireProfileIdsExist) in that case, leveraging
359+
the presence of the performRelease property. -->
360+
<name>!performRelease</name>
361+
</property>
362+
</activation>
363+
<build>
364+
<plugins>
365+
<plugin>
366+
<groupId>org.apache.maven.plugins</groupId>
367+
<artifactId>maven-enforcer-plugin</artifactId>
368+
<version>3.5.0</version>
369+
<executions>
370+
<!-- Prevent users from mistyping a profile name -->
371+
<execution>
372+
<id>enforce-valid-profile</id>
373+
<configuration>
374+
<rules>
375+
<requireProfileIdsExist/>
376+
</rules>
377+
</configuration>
378+
<goals>
379+
<goal>enforce</goal>
380+
</goals>
381+
</execution>
382+
<!-- Ensure that greatest version of each transitive dependency got selected -->
383+
<execution>
384+
<id>enforce-dependency-upper-bound</id>
385+
<configuration>
386+
<rules>
387+
<requireUpperBoundDeps/>
388+
</rules>
389+
</configuration>
390+
<goals>
391+
<goal>enforce</goal>
392+
</goals>
393+
</execution>
394+
</executions>
395+
<!--
396+
workaround for https://github.com/mojohaus/extra-enforcer-rules/issues/132
397+
Remove when it's fixed upstream.
398+
-->
399+
<dependencies>
400+
<dependency>
401+
<groupId>org.codehaus.mojo</groupId>
402+
<artifactId>extra-enforcer-rules</artifactId>
403+
<version>1.8.0</version>
404+
</dependency>
405+
<dependency>
406+
<groupId>org.apache.maven.shared</groupId>
407+
<artifactId>maven-dependency-tree</artifactId>
408+
<version>3.3.0</version>
409+
</dependency>
410+
</dependencies>
411+
</plugin>
412+
</plugins>
413+
</build>
414+
</profile>
352415
<profile>
353416
<id>enable-verbose-grpc-logs</id>
354417
<properties>
@@ -668,54 +731,6 @@
668731
</execution>
669732
</executions>
670733
</plugin>
671-
<plugin>
672-
<groupId>org.apache.maven.plugins</groupId>
673-
<artifactId>maven-enforcer-plugin</artifactId>
674-
<version>3.5.0</version>
675-
<executions>
676-
<!-- Prevent users from mistyping a profile name -->
677-
<execution>
678-
<id>enforce-valid-profile</id>
679-
<configuration>
680-
<rules>
681-
<requireProfileIdsExist/>
682-
</rules>
683-
</configuration>
684-
<goals>
685-
<goal>enforce</goal>
686-
</goals>
687-
</execution>
688-
<!-- Ensure that greatest version of each transitive dependency got selected -->
689-
<execution>
690-
<id>enforce-dependency-upper-bound</id>
691-
<configuration>
692-
<rules>
693-
<requireUpperBoundDeps/>
694-
</rules>
695-
</configuration>
696-
<goals>
697-
<goal>enforce</goal>
698-
</goals>
699-
</execution>
700-
</executions>
701-
<!--
702-
workaround for https://github.com/mojohaus/extra-enforcer-rules/issues/132
703-
Remove when it's fixed upstream.
704-
-->
705-
<dependencies>
706-
<dependency>
707-
<groupId>org.codehaus.mojo</groupId>
708-
<artifactId>extra-enforcer-rules</artifactId>
709-
<version>1.8.0</version>
710-
</dependency>
711-
<dependency>
712-
<groupId>org.apache.maven.shared</groupId>
713-
<artifactId>maven-dependency-tree</artifactId>
714-
<version>3.3.0</version>
715-
</dependency>
716-
</dependencies>
717-
</plugin>
718-
719734
<plugin>
720735
<groupId>org.apache.maven.plugins</groupId>
721736
<artifactId>maven-dependency-plugin</artifactId>

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/TableTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public void testFromProto() {
9090
assertThat(result.isAutomatedBackupEnabled()).isTrue();
9191
assertEquals(
9292
result.getAutomatedBackupPolicy().viewConfig(),
93-
"AutomatedBackupPolicy{com.google.bigtable.admin.v2.Table$AutomatedBackupPolicy.retention_period=seconds: 1\n"
93+
"AutomatedBackupPolicy{com.google.bigtable.admin.v2.Table$AutomatedBackupPolicy.retention_period=seconds:"
94+
+ " 1\n"
9495
+ //
9596
"nanos: 99\n"
9697
+ //

0 commit comments

Comments
 (0)