Skip to content

Commit 715c7c5

Browse files
author
Komal Yadav
committed
Implemented exit gate
updated updated updated updated
1 parent 5b70b2f commit 715c7c5

File tree

3 files changed

+126
-33
lines changed

3 files changed

+126
-33
lines changed

.github/workflows/cloudbuild.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright © 2025 Cask Data, Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
3+
# use this file except in compliance with the License. You may obtain a copy of
4+
# the License at
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
# Unless required by applicable law or agreed to in writing, software
7+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
9+
# License for the specific language governing permissions and limitations under
10+
# the License.
11+
12+
steps:
13+
- name: 'gcr.io/cloud-builders/mvn:3.8-jdk-8'
14+
id: maven-package
15+
entrypoint: 'mvn'
16+
args:
17+
- clean
18+
- -B
19+
- -V
20+
- -DskipTests
21+
- deploy
22+
- -P
23+
- common-artifacts
24+
- oss-exit-gate
25+
- -Dmaven.wagon.http.retryHandler.count=5
26+
- -Dmaven.wagon.httpconnectionManager.ttlSeconds=30
27+
28+
- name: 'bash'
29+
id: create-exit-gate-manifest
30+
entrypoint: 'bash'
31+
args:
32+
- '-c'
33+
- |
34+
set -e
35+
MANIFEST_FILE="/workspace/exit_gate_manifest.textproto"
36+
echo '# -*- protobuffer -*-' > "$${MANIFEST_FILE}"
37+
echo '# proto-file: security/opensource/exit_gate_v1/onboarded/proto/publishing_manifest.proto' >> "$${MANIFEST_FILE}"
38+
echo '# proto-message: PublishingManifest' >> "$${MANIFEST_FILE}"
39+
echo '' >> "$${MANIFEST_FILE}"
40+
echo 'publish_all: true' >> "$${MANIFEST_FILE}"
41+
echo "Created manifest file: $${MANIFEST_FILE}"
42+
waitFor: ['maven-package']
43+
44+
- name: 'gcr.io/cloud-builders/gsutil'
45+
id: upload-exit-gate-manifest
46+
entrypoint: 'bash'
47+
args:
48+
- '-c'
49+
- |
50+
set -e
51+
MANIFEST_FILE="/workspace/exit_gate_manifest.textproto"
52+
# Use a timestamp to create a unique manifest filename for each release
53+
MANIFEST_FILENAME="release_$(date -u +%Y%m%d%H%M%S).textproto"
54+
echo "Uploading manifest to $${SECURE_PUBLISH_BUCKET}$${MANIFEST_FILENAME}"
55+
gsutil cp "$${MANIFEST_FILE}" "$${SECURE_PUBLISH_BUCKET}$${MANIFEST_FILENAME}"
56+
echo "Manifest uploaded successfully. OSS Exit Gate process should now be triggered."
57+
waitFor: ['create-exit-gate-manifest']
58+
59+
artifacts:
60+
mavenArtifacts:
61+
- repository: 'https://us-maven.pkg.dev/oss-exit-gate-prod/cloud-data-fusion--mavencentral'
62+
deployFolder: '/workspace/target/'
63+
groupId: 'io.cdap.plugin'
64+
artifactId: 'google-cloud'
65+
version: $VERSION
66+
67+
options:
68+
requestedVerifyOption: VERIFIED
69+
machineType: 'E2_HIGHCPU_32'
70+

.github/workflows/tag-release.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ jobs:
2929
CDAP_OSSRH_USERNAME:cdapio-github-builds/CDAP_OSSRH_USERNAME
3030
CDAP_OSSRH_PASSWORD:cdapio-github-builds/CDAP_OSSRH_PASSWORD
3131
CDAP_GPG_PASSPHRASE:cdapio-github-builds/CDAP_GPG_PASSPHRASE
32+
CDAP_GPG_PASSPHRASE:cdapio-github-builds/CDAP_GPG_PASSPHRASE
3233
CDAP_GPG_PRIVATE_KEY:cdapio-github-builds/CDAP_GPG_PRIVATE_KEY
34+
SECURE_PUBLISH_BUCKET:cdapio-github-builds/publish_bucket
3335
3436
- name: Checkout Repository
3537
uses: actions/checkout@v4
@@ -59,10 +61,26 @@ jobs:
5961
- name: Run tests
6062
run: mvn clean test -fae -T 2 -B -V -DcloudBuild -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.wagon.httpconnectionManager.ttlSeconds=30
6163

62-
- name: Publish to Maven Central
63-
run: mvn clean -B -V -DskipTests deploy -P release -Dgpg.passphrase=$CDAP_GPG_PASSPHRASE -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.wagon.httpconnectionManager.ttlSeconds=30
64+
- name: Get Project Version
65+
id: get_version
66+
working-directory: google-cloud
67+
run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
68+
69+
- name: Publish SNAPSHOT to Maven Central
70+
if: ${{ endsWith(steps.get_version.outputs.VERSION, '-SNAPSHOT') }}
71+
run: mvn clean -B -V -DskipTests deploy -P snapshot-release common-artifacts -Dgpg.passphrase=$CDAP_GPG_PASSPHRASE -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.wagon.httpconnectionManager.ttlSeconds=30
6472
env:
6573
CDAP_OSSRH_USERNAME: ${{ steps.secrets.outputs.CDAP_OSSRH_USERNAME }}
6674
CDAP_OSSRH_PASSWORD: ${{ steps.secrets.outputs.CDAP_OSSRH_PASSWORD }}
6775
CDAP_GPG_PASSPHRASE: ${{ steps.secrets.outputs.CDAP_GPG_PASSPHRASE }}
68-
MAVEN_OPTS: '-Xmx3200m'
76+
MAVEN_OPTS: '-Xmx3200m'
77+
78+
- name: Submit Build to GCB
79+
if: ${{ !endsWith(steps.get_version.outputs.VERSION, '-SNAPSHOT') }}
80+
id: gcb
81+
working-directory: google-cloud
82+
run: |
83+
gcloud builds submit . \
84+
--config=cloudbuild-release.yaml \
85+
--project='cdapio-github-builds'
86+
--substitutions="_VERSION=${{steps.get_version.outputs.VERSION}},_SECURE_PUBLISH_BUCKET=${{steps.secrets.outputs.SECURE_PUBLISH_BUCKET}}, _GPG_PASSPHRASE=${{ steps.secrets.outputs.CDAP_GPG_PASSPHRASE }}"

pom.xml

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,6 @@
106106
</dependencies>
107107
</dependencyManagement>
108108

109-
<repositories>
110-
<repository>
111-
<id>sonatype-snapshots</id>
112-
<url>https://central.sonatype.com/repository/maven-snapshots</url>
113-
<releases>
114-
<enabled>false</enabled>
115-
</releases>
116-
<snapshots>
117-
<enabled>true</enabled>
118-
</snapshots>
119-
</repository>
120-
</repositories>
121109

122110
<dependencies>
123111
<!-- Start: dependency used by the Dataplex connector -->
@@ -904,6 +892,13 @@
904892
</dependencies>
905893

906894
<build>
895+
<extensions>
896+
<extension>
897+
<groupId>com.google.cloud.artifactregistry</groupId>
898+
<artifactId>artifactregistry-maven-wagon</artifactId>
899+
<version>2.2.5</version>
900+
</extension>
901+
</extensions>
907902
<testSourceDirectory>${testSourceLocation}</testSourceDirectory>
908903
<plugins>
909904
<plugin>
@@ -1058,7 +1053,7 @@
10581053
<!-- Profile for release. Includes signing of jars. -->
10591054
<profiles>
10601055
<profile>
1061-
<id>release</id>
1056+
<id>common-artifacts</id>
10621057
<build>
10631058
<plugins>
10641059
<!-- Source JAR -->
@@ -1128,23 +1123,13 @@
11281123
</execution>
11291124
</executions>
11301125
</plugin>
1131-
1132-
<plugin>
1133-
<groupId>org.apache.maven.plugins</groupId>
1134-
<artifactId>maven-gpg-plugin</artifactId>
1135-
<version>1.5</version>
1136-
<configuration>
1137-
<passphrase>${gpg.passphrase}</passphrase>
1138-
<useAgent>${gpg.useagent}</useAgent>
1139-
</configuration>
1140-
<executions>
1141-
<execution>
1142-
<goals>
1143-
<goal>sign</goal>
1144-
</goals>
1145-
</execution>
1146-
</executions>
1147-
</plugin>
1126+
</plugins>
1127+
</build>
1128+
</profile>
1129+
<profile>
1130+
<id>snapshot-release</id>
1131+
<build>
1132+
<plugins>
11481133
<plugin>
11491134
<groupId>org.sonatype.central</groupId>
11501135
<artifactId>central-publishing-maven-plugin</artifactId>
@@ -1159,6 +1144,26 @@
11591144
</plugins>
11601145
</build>
11611146
</profile>
1147+
<profile>
1148+
<id>oss-exit-gate</id>
1149+
<distributionManagement>
1150+
<repository>
1151+
<id>artifact-registry</id>
1152+
<url>
1153+
artifactregistry://us-central1-maven.pkg.dev/oss-exit-gate-prod/cloud-data-fusion--mavencentral
1154+
</url>
1155+
</repository>
1156+
</distributionManagement>
1157+
<repositories>
1158+
<repository>
1159+
<id>artifact-registry</id>
1160+
<url>artifactregistry://us-maven.pkg.dev/oss-exit-gate-prod/cloud-data-fusion--mavencentral</url>
1161+
<releases>
1162+
<enabled>true</enabled>
1163+
</releases>
1164+
</repository>
1165+
</repositories>
1166+
</profile>
11621167
<profile>
11631168
<id>cloudBuild</id>
11641169
<activation>

0 commit comments

Comments
 (0)