Skip to content

Commit d7cf51a

Browse files
author
Komal Yadav
committed
Add exit gate
updated updated updated updated updated updated updated updated
1 parent a5ac924 commit d7cf51a

3 files changed

Lines changed: 97 additions & 66 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2022 Cask Data, Inc.
1+
# Copyright © 2025 Cask Data, Inc.
22
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
33
# use this file except in compliance with the License. You may obtain a copy of
44
# the License at
@@ -25,16 +25,6 @@ jobs:
2525
branch: [ develop ]
2626

2727
steps:
28-
- name: Get Secrets from GCP Secret Manager
29-
id: 'secrets'
30-
uses: 'google-github-actions/get-secretmanager-secrets@v0'
31-
with:
32-
secrets: |-
33-
CDAP_OSSRH_USERNAME:cdapio-github-builds/CDAP_OSSRH_USERNAME
34-
CDAP_OSSRH_PASSWORD:cdapio-github-builds/CDAP_OSSRH_PASSWORD
35-
CDAP_GPG_PASSPHRASE:cdapio-github-builds/CDAP_GPG_PASSPHRASE
36-
CDAP_GPG_PRIVATE_KEY:cdapio-github-builds/CDAP_GPG_PRIVATE_KEY
37-
3828
- name: Recursively Checkout Repository
3929
uses: actions/checkout@v3
4030
with:
@@ -50,23 +40,10 @@ jobs:
5040
restore-keys: |
5141
${{ runner.os }}-maven-${{ github.workflow }}
5242
53-
- name: Set up GPG conf
54-
run: |
55-
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
56-
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
57-
58-
- name: Import GPG key
59-
run: |
60-
echo "$GPG_PRIVATE_KEY" > private.key
61-
gpg --import --batch private.key
62-
env:
63-
GPG_PRIVATE_KEY: ${{ steps.secrets.outputs.CDAP_GPG_PRIVATE_KEY }}
64-
65-
- name: Deploy Maven
43+
- name: Submit Build to GCB
44+
id: gcb
6645
working-directory: twill
67-
run: mvn deploy -B -V -DskipTests -P hadoop-2.6 -Dgpg.passphrase=$CDAP_GPG_PASSPHRASE -Dremoteresources.skip=true
68-
env:
69-
CDAP_OSSRH_USERNAME: ${{ steps.secrets.outputs.CDAP_OSSRH_USERNAME }}
70-
CDAP_OSSRH_PASSWORD: ${{ steps.secrets.outputs.CDAP_OSSRH_PASSWORD }}
71-
CDAP_GPG_PASSPHRASE: ${{ steps.secrets.outputs.CDAP_GPG_PASSPHRASE }}
72-
MAVEN_OPTS: "-Xmx12G"
46+
run: |
47+
gcloud builds submit . \
48+
--config=cloudbuild.yaml \
49+
--project='cdapio-github-builds' \

cloudbuild.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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: deploy-to-artifact-registry
15+
entrypoint: 'mvn'
16+
args:
17+
- 'deploy'
18+
- '-B'
19+
- '-V'
20+
- '-DskipTests'
21+
- '-P hadoop-2.6'
22+
- '-Drat.skip=true'
23+
- '-Dremoteresources.skip=true'
24+
- '-Dmaven.wagon.http.google.EffectiveVersion=1.0.1'
25+
26+
- name: 'bash'
27+
id: create-exit-gate-manifest
28+
entrypoint: 'bash'
29+
args:
30+
- '-c'
31+
- |
32+
set -e
33+
MANIFEST_FILE="/workspace/exit_gate_manifest.textproto"
34+
echo '# -*- protobuffer -*-' > "$${MANIFEST_FILE}"
35+
echo '# proto-file: security/opensource/exit_gate_v1/onboarded/proto/publishing_manifest.proto' >> "$${MANIFEST_FILE}"
36+
echo '# proto-message: PublishingManifest' >> "$${MANIFEST_FILE}"
37+
echo '' >> "$${MANIFEST_FILE}"
38+
echo 'publish_all: true' >> "$${MANIFEST_FILE}"
39+
echo "Created manifest file: $${MANIFEST_FILE}"
40+
waitFor: ['deploy-to-artifact-registry']
41+
42+
- name: 'gcr.io/cloud-builders/gsutil'
43+
id: upload-exit-gate-manifest
44+
entrypoint: 'bash'
45+
args:
46+
- '-c'
47+
- |
48+
set -e
49+
GCS_MANIFEST_DIR="gs://oss-exit-gate-prod-projects-bucket/cloud-data-fusion/mavencentral/manifests/"
50+
MANIFEST_FILE="/workspace/exit_gate_manifest.textproto"
51+
# Use a timestamp to create a unique manifest filename for each release
52+
MANIFEST_FILENAME="release_$(date -u +%Y%m%d%H%M%S).textproto"
53+
echo "Uploading manifest to $${GCS_MANIFEST_DIR}$${MANIFEST_FILENAME}"
54+
gsutil cp "$${MANIFEST_FILE}" "$${GCS_MANIFEST_DIR}$${MANIFEST_FILENAME}"
55+
echo "Manifest uploaded successfully. OSS Exit Gate process should now be triggered."
56+
waitFor: ['create-exit-gate-manifest']
57+
58+
options:
59+
machineType: 'E2_HIGHCPU_32'

pom.xml

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,38 @@
9696
<scala.version>2.12.10</scala.version>
9797
</properties>
9898

99+
<distributionManagement>
100+
<snapshotRepository>
101+
<id>artifact-registry</id>
102+
<url>artifactregistry://us-maven.pkg.dev/oss-exit-gate-prod/cloud-data-fusion--mavencentral</url>
103+
</snapshotRepository>
104+
<repository>
105+
<id>artifact-registry</id>
106+
<url>artifactregistry://us-maven.pkg.dev/oss-exit-gate-prod/cloud-data-fusion--mavencentral</url>
107+
</repository>
108+
</distributionManagement>
109+
110+
<repositories>
111+
<repository>
112+
<id>artifact-registry</id>
113+
<url>artifactregistry://us-maven.pkg.dev/oss-exit-gate-prod/cloud-data-fusion--mavencentral</url>
114+
<releases>
115+
<enabled>true</enabled>
116+
</releases>
117+
<snapshots>
118+
<enabled>true</enabled>
119+
</snapshots>
120+
</repository>
121+
</repositories>
122+
99123
<build>
124+
<extensions>
125+
<extension>
126+
<groupId>com.google.cloud.artifactregistry</groupId>
127+
<artifactId>artifactregistry-maven-wagon</artifactId>
128+
<version>2.2.5</version>
129+
</extension>
130+
</extensions>
100131
<pluginManagement>
101132
<plugins>
102133
<plugin>
@@ -210,34 +241,6 @@
210241
</execution>
211242
</executions>
212243
</plugin>
213-
<plugin>
214-
<groupId>org.sonatype.central</groupId>
215-
<artifactId>central-publishing-maven-plugin</artifactId>
216-
<version>0.8.0</version>
217-
<extensions>true</extensions>
218-
<configuration>
219-
<publishingServerId>sonatype.release</publishingServerId>
220-
<autoPublish>false</autoPublish>
221-
<ignorePublishedComponents>true</ignorePublishedComponents>
222-
</configuration>
223-
</plugin>
224-
<!-- GPG signature -->
225-
<plugin>
226-
<groupId>org.apache.maven.plugins</groupId>
227-
<artifactId>maven-gpg-plugin</artifactId>
228-
<version>1.5</version>
229-
<configuration>
230-
<passphrase>${gpg.passphrase}</passphrase>
231-
<useAgent>${gpg.useagent}</useAgent>
232-
</configuration>
233-
<executions>
234-
<execution>
235-
<goals>
236-
<goal>sign</goal>
237-
</goals>
238-
</execution>
239-
</executions>
240-
</plugin>
241244
</plugins>
242245
</pluginManagement>
243246
<plugins>
@@ -282,14 +285,6 @@
282285
</includes>
283286
</configuration>
284287
</plugin>
285-
<plugin>
286-
<groupId>org.sonatype.central</groupId>
287-
<artifactId>central-publishing-maven-plugin</artifactId>
288-
</plugin>
289-
<plugin>
290-
<groupId>org.apache.maven.plugins</groupId>
291-
<artifactId>maven-gpg-plugin</artifactId>
292-
</plugin>
293288
</plugins>
294289
</build>
295290

0 commit comments

Comments
 (0)