Google Cloud Builder - Gradle

萝らか妹 提交于 2019-12-23 16:19:48

问题


Following the post at https://cloudplatform.googleblog.com/2017/03/Google-Cloud-Container-Builder-a-fast-and-flexible-way-to-package-your-software.html

I understand that Gradle is supported for Google Container Builder. Yet I am not able to find any examples. I am specifically interested in setting the gradle version explicitly in the build.


回答1:


We build Spinnaker components using Gradle within Google Cloud Container Builder.

We have a Gradle wrapper checked into our GitHub repo, and we set the version within the distributionUrl of the gradle-wrapper.properties file:

#Thu Nov 12 15:41:58 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip

Source: https://github.com/spinnaker/gate/blob/master/gradle/wrapper/gradle-wrapper.properties

We then call ./gradlew normally. Here's a cloudbuild.yaml example from the same repo:

steps:
- name: 'java:8'
  env: ["GRADLE_USER_HOME=cache"]
  entrypoint: "bash"
  args: [ "-c", "./gradlew gate-web:installDist -x test"]
- name: 'gcr.io/cloud-builders/docker'
  args: ["build", "-t", "gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA", "-t", "gcr.io/$PROJECT_ID/$REPO_NAME:latest", "-f", "Dockerfile.slim", "."]
images:
- 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/$REPO_NAME:latest'

Source: https://github.com/spinnaker/gate/blob/master/cloudbuild.yaml



来源:https://stackoverflow.com/questions/42638864/google-cloud-builder-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!