Hello!
I'm trying to use pipelines to build a project with Maven and and then deploy using the google-app-engine-deploy pipe.
Here's my pipelines.yaml file which I created starting with the Maven build template:
pipelines:
branches:
dev: #can use {master, integration, dev}: for executing on all 3
- parallel:
- step:
name: Proxy setup and Build MemberApp
script:
- echo "Downloading gcloud cli"
- curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-437.0.1-linux-x86_64.tar.gz
- tar -xf google-cloud-cli-437.0.1-linux-x86_64.tar.gz -C /tmp
- /tmp/google-cloud-sdk/install.sh
- source /tmp/google-cloud-sdk/path.bash.inc
- echo "Regisering gcloud key"
- echo $KEY_FILE | base64 --decode --ignore-garbage > /tmp/gcloud-api-key.json
- gcloud auth activate-service-account --key-file /tmp/gcloud-api-key.json
- gcloud config set project $GCLOUD_PROJECT
- echo "Installing the cloudsql proxy client"
- curl -o cloud-sql-proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.4.0/cloud-sql-proxy.linux.amd64
- chmod +x cloud-sql-proxy
- ./cloud-sql-proxy $CLOUDSQL_CONN_NAME > cloudsql.log 2>&1 &
- mvn -B clean install package --file pom.xml
- pipe: atlassian/google-app-engine-deploy:1.2.0
variables:
KEY_FILE: $KEY_FILE
PROJECT: $GCLOUD_PROJECT
DEPLOYABLES: 'src/main/appengine/app.yaml'
STOP_PREVIOUS_VERSION: 'true'
after-script:
# Collect checkstyle results, if any, and convert to Bitbucket Code Insights.
- pipe: atlassian/checkstyle-report:0.3.0
artifacts:
- cloudsql.log
- step:
name: Security Scan
script:
# Run a security scan for sensitive data.
# See more security tools at https://bitbucket.org/product/features/pipelines/integrations?&category=security
- pipe: atlassian/git-secrets-scan:0.5.1
The testing phase uses cloudsql proxy to test against a staged database, so the bulk of that is configuring the cloud cli and sql proxy.
The build results look fine as far as I can tell:
<span>[INFO] The original artifact has been renamed to /opt/atlassian/pipelines/agent/build/target/MemberApp-0.0.1-SNAPSHOT.jar.original</span>
<span>[INFO] ------------------------------------------------------------------------</span><span>[INFO] BUILD SUCCESS</span><span>[INFO] ------------------------------------------------------------------------</span><span>[INFO] Total time: 22.467 s</span><span>[INFO] Finished at: 2023-07-08T12:50:37Z</span><span>[INFO] ------------------------------------------------------------------------</span>When it gets to the deploy step, then it fails:
INFO: Setting up environment.
echo "${KEY_FILE}" | base64 -d >> /tmp/key-file.json
gcloud auth activate-service-account --key-file /tmp/key-file.json --quiet --verbosity=warning
Activated service account credentials for: [[redacted]-205917@appspot.gserviceaccount.com]
gcloud config set project [redacted]-205917 --quiet --verbosity=warning
Updated property [core/project].
INFO: Starting deployment to GCP app engine...
gcloud app --quiet deploy src/main/appengine/app.yaml --stop-previous-version --verbosity=warning
Services to deploy:
descriptor: [/opt/atlassian/pipelines/agent/build/src/main/appengine/app.yaml]
source: [/opt/atlassian/pipelines/agent/build/src/main/appengine]
target project: [[redacted]-205917]
target service: [member-web-service]
target version: [20230708t125134]
target url: [https://member-web-service-dot-[redacted]-205917.uc.r.appspot.com]
target service account: [[redacted]-205917@appspot.gserviceaccount.com]
Beginning deployment of service [member-web-service]...
Created .gcloudignore file. See `gcloud topic gcloudignore` for details.
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 0 files to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [member-web-service]...
...........................................................................................................................failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 40538f50-fc9b-4917-b931-30d7a694713f status: FAILURE
did not find any jar files with a Main-Class manifest entry
Full build logs: https://console.cloud.google.com/cloud-build/builds;region=us-central1/40538f50-fc9b-4917-b931-30d7a694713f?project=496993301316
✖ Deployment failed.
Seems really strange as everything is running smooth until it tells me there's 0 files that were uploaded, but I think that's just because my code hasn't changed and the sum of the files should be identical. I will note that when I run the deploy with Maven locally, it deploys just fine. I only seem to have issues while using the pipeline.