Skip to content

Implemented exit gate #1

Implemented exit gate

Implemented exit gate #1

Workflow file for this run

# Copyright © 2025 Cask Data, Inc.

Check failure on line 1 in .github/workflows/cloudbuild.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/cloudbuild.yaml

Invalid workflow file

(Line: 15, Col: 1): Unexpected value 'steps', (Line: 150, Col: 1): Unexpected value 'options', (Line: 15, Col: 1): Required property is missing: jobs
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
steps:
- name: 'gcr.io/cdapio-github-builds/runner'
id: build-standalone
entrypoint: 'bash'
env:
- 'MAVEN_OPTS=-Xmx12G'
args:
- '-c'
- |
set -ex
yarn global add node-gyp
echo ">>> Running Maven build..."
MVN_CMD="mvn -e -T2 -U clean package \
-Dgpg.skip=true \
-DskipTests=true \
-Ddocker.skip=true \
-Dadditional.artifacts.dir=/workspace/app-artifacts \
-Dsecurity.extensions.dir=/workspace/security-extensions \
-nsu -am -amd \
-Ptemplates,dist,release \
-Dmaven.wagon.http.retryHandler.count=5 \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=30"
$$MVN_CMD
- name: 'gcr.io/cdapio-github-builds/runner'
id: build-distributions
entrypoint: 'bash'
args:
- '-c'
- |
set -ex
echo ">>> Building Distribution Artifacts (DEB, RPM, TGZ)..."
# Run package on the distributions module, 'package' phase without 'clean'
# Assumes dependencies are available from the previous build-standalone step
MAVEN_OPTS="-Xmx12G" mvn -B -V -e -U package \
-DskipTests=true -Dgpg.skip=true -Ddocker.skip=true -nsu \
-P templates,dist,release,rpm-prepare,rpm,deb-prepare,deb,tgz \
-Dadditional.artifacts.dir=/workspace/app-artifacts \
-Dsecurity.extensions.dir=/workspace/security-extensions
echo ">>> Distribution Builds Complete."
waitFor: [ 'build-standalone' ]
- name: 'bash'
id: create-deb-bundle
entrypoint: 'bash'
args:
- '-c'
- |
set -e
VERSION=${_CDAP_VERSION}
echo "Packaging DEB bundle for version $$VERSION"
mkdir -p cdap/cdap-distributions/target/deb-bundle-tmp
cd cdap/cdap-distributions/target/deb-bundle-tmp
find /workspace/cdap -name "*.deb" -exec cp {} . \;
if [ -z "$(ls -A *.deb 2>/dev/null)" ]; then
echo "ERROR: No .deb files found to bundle!"
exit 1
fi
tar zcf ../cdap-distributed-deb-bundle-$${VERSION}.tgz *.deb
echo "Created DEB bundle: $(pwd)/../cdap-distributed-deb-bundle-$${VERSION}.tgz"
cd /workspace
waitFor: [ 'build-distributions' ]
- name: 'anchore/syft:v1.5.0'
id: generate-sbom
args:
- 'packages'
- '-o'
- 'spdx-json=/workspace/attestations/project-sbom.spdx.json'
- '.'
waitFor: [ 'build-distributions' ]
- name: 'bash'
id: stage-artifacts
entrypoint: 'bash'
args:
- '-c'
- |
set -e
mkdir -p /workspace/staging
mkdir -p /workspace/attestations
VERSION=${_CDAP_VERSION}
echo "Copying Maven artifacts..."
find . -type f \( -name "*.jar" -o -name "*.pom" -o -name "*.war" \) \
! -name "original-*.jar" ! -name "*-tests.jar" \
! -path "*/target/site/*" ! -path "*/target/apidocs/*" \
! -path "*/target/dependency-cache/*" ! -path "*/target/maven-archiver/*" \
! -path "*/target/generated-sources/*" ! -path "*/target/maven-status/*" \
-exec cp --parents {} /workspace/staging/ \;
echo "Copying Standalone ZIP..."
cp cdap/cdap-standalone/target/cdap-sandbox-$${VERSION}.zip /workspace/staging/
echo "Copying DEB bundle..."
cp cdap/cdap-distributions/target/cdap-distributed-deb-bundle-$${VERSION}.tgz /workspace/staging/
echo "Copying SBOM..."
cp /workspace/attestations/project-sbom.spdx.json /workspace/staging/
echo "Staged files (top level):"
ls -l /workspace/staging
waitFor: [ 'create-deb-bundle', 'generate-sbom' ]
- name: 'bash'
id: create-manifest
entrypoint: 'bash'
args:
- '-c'
- |
set -e
echo "Creating manifest.json..."
cd /workspace/staging
printf '{\n "artifacts": [\n' > manifest.json
find . -type f ! -name "manifest.json" | sed 's|./||' | sort | sed 's/.*/ "&",/' >> manifest.json
sed -i '$ s/,$//' manifest.json
printf '\n ]\n}\n' >> manifest.json
echo "Generated manifest.json:"
cat manifest.json
cd /workspace
waitFor: [ 'stage-artifacts' ]
- name: 'gcr.io/cloud-builders/gsutil'
id: upload-to-staging-bucket
args:
- '-m'
- 'cp'
- '-r'
- '/workspace/staging/*'
- 'gs://${_SECURE_PUBLISH_BUCKET_NAME}/${_ARTIFACT_ID}/${BUILD_ID}/'
waitFor: [ 'create-manifest' ]
options:
requestedVerifyOption: VERIFIED
machineType: 'E2_HIGHCPU_32'