|
| 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/gcloud' |
| 14 | + id: setup-gpg |
| 15 | + entrypoint: 'bash' |
| 16 | + secretEnv: ['GPG_KEY'] |
| 17 | + args: |
| 18 | + - '-c' |
| 19 | + - | |
| 20 | + set -e |
| 21 | + export GNUPGHOME=/workspace/.gnupg |
| 22 | + mkdir -p $$GNUPGHOME |
| 23 | + chmod 700 $$GNUPGHOME |
| 24 | +
|
| 25 | + echo "pinentry-mode loopback" >> $$GNUPGHOME/gpg.conf |
| 26 | + echo "allow-loopback-pinentry" >> $$GNUPGHOME/gpg-agent.conf |
| 27 | + |
| 28 | + echo "$$GPG_KEY" | gpg --batch --import |
| 29 | + echo "GPG key imported into $$GNUPGHOME." |
| 30 | +
|
| 31 | + - name: 'gcr.io/cloud-builders/mvn:3.8-jdk-8' |
| 32 | + id: maven-package |
| 33 | + entrypoint: 'mvn' |
| 34 | + args: |
| 35 | + - 'deploy' |
| 36 | + - '-B' |
| 37 | + - '-V' |
| 38 | + - '-DskipTests' |
| 39 | + - "-Dgpg.passphrase=$${GPG_PASSPHRASE}" |
| 40 | + - '-Pcommon-artifacts,version-release' |
| 41 | + - '-DaltDeploymentRepository=local::default::file:///workspace/target' |
| 42 | + - '-Dmaven.wagon.http.retryHandler.count=5' |
| 43 | + - '-Dmaven.wagon.httpconnectionManager.ttlSeconds=30' |
| 44 | + env: |
| 45 | + - 'GNUPGHOME=/workspace/.gnupg' |
| 46 | + secretEnv: [ 'GPG_PASSPHRASE' ] |
| 47 | + |
| 48 | + |
| 49 | + - name: 'bash' |
| 50 | + id: create-exit-gate-manifest |
| 51 | + entrypoint: 'bash' |
| 52 | + args: |
| 53 | + - '-c' |
| 54 | + - | |
| 55 | + set -e |
| 56 | + MANIFEST_FILE="/workspace/publish_manifest.textproto" |
| 57 | + echo '# -*- protobuffer -*-' > "$${MANIFEST_FILE}" |
| 58 | + echo '# proto-file: security/opensource/exit_gate_v1/onboarded/proto/publishing_manifest.proto' >> "$${MANIFEST_FILE}" |
| 59 | + echo '# proto-message: PublishingManifest' >> "$${MANIFEST_FILE}" |
| 60 | + echo '' >> "$${MANIFEST_FILE}" |
| 61 | + echo 'publish_all: true' >> "$${MANIFEST_FILE}" |
| 62 | + echo "Created manifest file: $${MANIFEST_FILE}" |
| 63 | + waitFor: ['maven-package'] |
| 64 | + |
| 65 | + - name: 'gcr.io/cloud-builders/gsutil' |
| 66 | + id: upload-exit-gate-manifest |
| 67 | + entrypoint: 'bash' |
| 68 | + args: |
| 69 | + - '-c' |
| 70 | + - | |
| 71 | + set -e |
| 72 | + GCS_MANIFEST_DIR="gs://oss-exit-gate-prod-projects-bucket/cloud-data-fusion/githubreleases/manifests/" |
| 73 | + MANIFEST_FILE="/workspace/publish_manifest.textproto" |
| 74 | + MANIFEST_FILENAME="release_${_VERSION}.textproto" |
| 75 | + echo "Uploading manifest to $${GCS_MANIFEST_DIR}$${MANIFEST_FILENAME}" |
| 76 | + gsutil cp "$${MANIFEST_FILE}" "$${GCS_MANIFEST_DIR}$${MANIFEST_FILENAME}" |
| 77 | + echo "Manifest uploaded successfully." |
| 78 | + waitFor: ['create-exit-gate-manifest'] |
| 79 | + |
| 80 | + |
| 81 | +substitutions: |
| 82 | + _VERSION: '0.25.0-SNAPSHOT' |
| 83 | + |
| 84 | +artifacts: |
| 85 | + mavenArtifacts: |
| 86 | + - repository: 'https://us-maven.pkg.dev/oss-exit-gate-prod/cloud-data-fusion--mavencentral' |
| 87 | + deployFolder: '/workspace/target/' |
| 88 | + groupId: 'io.cdap.plugin' |
| 89 | + artifactId: 'google-cloud' |
| 90 | + version: '${_VERSION}' |
| 91 | + |
| 92 | +options: |
| 93 | + requestedVerifyOption: VERIFIED |
| 94 | + machineType: 'E2_HIGHCPU_32' |
| 95 | + |
| 96 | + |
| 97 | +availableSecrets: |
| 98 | + secretManager: |
| 99 | + - versionName: projects/cdapio-github-builds/secrets/CDAP_GPG_PRIVATE_KEY/versions/latest |
| 100 | + env: 'GPG_KEY' |
| 101 | + - versionName: projects/cdapio-github-builds/secrets/CDAP_GPG_PASSPHRASE/versions/latest |
| 102 | + env: 'GPG_PASSPHRASE' |
0 commit comments