Skip to content

Commit 83a15eb

Browse files
author
Komal Yadav
committed
Add exit gate
updated updated updated updated updated updated
1 parent 7d2ab9f commit 83a15eb

File tree

3 files changed

+88
-73
lines changed

3 files changed

+88
-73
lines changed

.github/workflows/build-and-deploy.yaml

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2023 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, release/0.13 ]
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:
@@ -61,27 +51,12 @@ jobs:
6151
command: |
6252
cd common
6353
MAVEN_OPTS="-Xmx16G -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError" mvn test -T2 -U -V -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.wagon.httpconnectionManager.ttlSeconds=30
64-
65-
- name: Set up GPG conf
66-
if: ${{ matrix.branch == 'develop' || startsWith(matrix.branch, 'release/') }}
67-
run: |
68-
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
69-
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
7054
71-
- name: Import GPG key
72-
if: ${{ matrix.branch == 'develop' || startsWith(matrix.branch, 'release/') }}
73-
run: |
74-
echo "$GPG_PRIVATE_KEY" > private.key
75-
gpg --import --batch private.key
76-
env:
77-
GPG_PRIVATE_KEY: ${{ steps.secrets.outputs.CDAP_GPG_PRIVATE_KEY }}
78-
79-
- name: Deploy Maven
55+
- name: Submit Build to GCB
56+
id: gcb
8057
if: ${{ matrix.branch == 'develop' || startsWith(matrix.branch, 'release/') }}
8158
working-directory: common
82-
run: mvn deploy -B -V -P release -Dgpg.passphrase=$CDAP_GPG_PASSPHRASE -Dremoteresources.skip=true
83-
env:
84-
CDAP_OSSRH_USERNAME: ${{ steps.secrets.outputs.CDAP_OSSRH_USERNAME }}
85-
CDAP_OSSRH_PASSWORD: ${{ steps.secrets.outputs.CDAP_OSSRH_PASSWORD }}
86-
CDAP_GPG_PASSPHRASE: ${{ steps.secrets.outputs.CDAP_GPG_PASSPHRASE }}
87-
MAVEN_OPTS: "-Xmx12G"
59+
run: |
60+
gcloud builds submit . \
61+
--config=cloudbuild.yaml \
62+
--project='cdapio-github-builds' \

cloudbuild.yaml

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

pom.xml

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,26 @@ the License.
5757

5858
<repositories>
5959
<repository>
60-
<id>sonatype</id>
61-
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
60+
<id>artifact-registry</id>
61+
<url>artifactregistry:us-maven.pkg.dev/oss-exit-gate-prod/cloud-data-fusion--mavencentral</url>
6262
<releases>
63-
<enabled>false</enabled>
63+
<enabled>true</enabled>
6464
</releases>
6565
<snapshots>
6666
<enabled>true</enabled>
67-
<updatePolicy>always</updatePolicy>
68-
<checksumPolicy>fail</checksumPolicy>
6967
</snapshots>
7068
</repository>
7169
</repositories>
7270

7371
<distributionManagement>
74-
<repository>
75-
<id>sonatype.release</id>
76-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
77-
</repository>
7872
<snapshotRepository>
79-
<id>sonatype.snapshots</id>
80-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
73+
<id>artifact-registry</id>
74+
<url>artifactregistry://us-maven.pkg.dev/oss-exit-gate-prod/cloud-data-fusion--mavencentral</url>
8175
</snapshotRepository>
76+
<repository>
77+
<id>artifact-registry</id>
78+
<url>artifactregistry://us-maven.pkg.dev/oss-exit-gate-prod/cloud-data-fusion--mavencentral</url>
79+
</repository>
8280
</distributionManagement>
8381

8482
<modules>
@@ -297,6 +295,13 @@ the License.
297295
</dependencyManagement>
298296

299297
<build>
298+
<extensions>
299+
<extension>
300+
<groupId>com.google.cloud.artifactregistry</groupId>
301+
<artifactId>artifactregistry-maven-wagon</artifactId>
302+
<version>2.2.5</version>
303+
</extension>
304+
</extensions>
300305
<pluginManagement>
301306
<plugins>
302307
<plugin>
@@ -438,36 +443,6 @@ the License.
438443
</execution>
439444
</executions>
440445
</plugin>
441-
442-
<!-- GPG signature -->
443-
<plugin>
444-
<groupId>org.apache.maven.plugins</groupId>
445-
<artifactId>maven-gpg-plugin</artifactId>
446-
<version>1.5</version>
447-
<configuration>
448-
<passphrase>${gpg.passphrase}</passphrase>
449-
<useAgent>${gpg.useagent}</useAgent>
450-
</configuration>
451-
<executions>
452-
<execution>
453-
<goals>
454-
<goal>sign</goal>
455-
</goals>
456-
</execution>
457-
</executions>
458-
</plugin>
459-
460-
<!-- Nexus deploy plugin -->
461-
<plugin>
462-
<groupId>org.sonatype.plugins</groupId>
463-
<artifactId>nexus-staging-maven-plugin</artifactId>
464-
<version>1.6.2</version>
465-
<extensions>true</extensions>
466-
<configuration>
467-
<nexusUrl>https://oss.sonatype.org</nexusUrl>
468-
<serverId>sonatype.release</serverId>
469-
</configuration>
470-
</plugin>
471446
</plugins>
472447
</pluginManagement>
473448

0 commit comments

Comments
 (0)