diff --git a/release/move_artifacts.sh b/release/build_nomulus_for_env.sh similarity index 60% rename from release/move_artifacts.sh rename to release/build_nomulus_for_env.sh index 67c8a4724..95ddd059a 100755 --- a/release/move_artifacts.sh +++ b/release/build_nomulus_for_env.sh @@ -12,16 +12,26 @@ # 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. - -# This script moves GAE artifacts for a given environment to a designated location. +# +# This script builds the GAE artifacts for a given environment, moves the +# artifacts for all services to a designated location, and then creates a +# tarball from there. if [ $# -ne 2 ]; then - echo "Usage: $0 alpha|crash|sandbox|production destination." + echo "Usage: $0 alpha|crash|sandbox|production " exit 1 fi +environment="$1" dest="$2/$1" +gcs_prefix="storage.googleapis.com/domain-registry-maven-repository" + +cd gradle +./gradlew clean stage -Penvironment="${environment}" \ + -PmavenUrl=https://"${gcs_prefix}"/maven \ + -PpluginsUrl=https://"${gcs_prefix}"/plugins +cd - mkdir -p "${dest}" @@ -29,3 +39,7 @@ for service in default pubapi backend tools do mv gradle/services/"${service}"/build/staged-app "${dest}/${service}" done + +cd "${dest}" +tar cvf ../../"${environment}.tar" . +cd - diff --git a/release/cloudbuild-nomulus.yaml b/release/cloudbuild-nomulus.yaml index b2149bb0e..da2c2cb27 100644 --- a/release/cloudbuild-nomulus.yaml +++ b/release/cloudbuild-nomulus.yaml @@ -3,71 +3,52 @@ # You will need access to a private registry, so be sure to install the docker # credential helper. # Then, in the root of a nomulus source tree, run: -# cloud-build-local --config=cloudbuild-nomulus.yaml --dryrun=false --substitutions TAG_NAME=[TAG] . +# cloud-build-local --config=cloudbuild-nomulus.yaml --dryrun=false \ +# --substitutions TAG_NAME=[TAG] .. # This will build the contents of the current directory and generate the # nomulus war-files locally. # The PROJECT_ID is the current project name that gcloud uses. # You can add "--push true" to have the image pushed to GCR. # # To manually trigger a build on GCB, run: -# gcloud builds submit --config cloudbuild-nomulus.yaml --substitutions TAG_NAME=[TAG] . +# gcloud builds submit --config cloudbuild-nomulus.yaml --substitutions TAG_NAME=[TAG] .. # # To trigger a build automatically, follow the instructions below and add a trigger: # https://cloud.google.com/cloud-build/docs/running-builds/automate-builds steps: # Set permissions correctly. Not sure why it is necessary, but it is. - name: 'gcr.io/${PROJECT_ID}/builder:latest' - entrypoint: /bin/bash args: ['chown', '-R', 'root:root', '.'] - name: 'gcr.io/${PROJECT_ID}/builder:latest' - entrypoint: /bin/bash args: ['chmod', '-R', '777', '.'] # Create a directory to store the artifacts - name: 'gcr.io/${PROJECT_ID}/builder:latest' - entrypoint: /bin/bash args: ['mkdir', 'nomulus'] # Run tests - name: 'gcr.io/${PROJECT_ID}/builder:latest' args: ['./gradlew', 'test'] dir: 'gradle' -# Build the deployment files for sandbox. +# Build and package the deployment files for alpha. - name: 'gcr.io/${PROJECT_ID}/builder:latest' - args: - - './gradlew' - - 'stage' - - '-x' - - 'autoLintGradle' - - '-Penvironment=sandbox' - - '-PmavenUrl=gcs://domain-registry-maven-repository/maven' - - '-PpluginsUrl=gcs://domain-registry-maven-repository/plugins' - dir: 'gradle' + args: ['release/build_nomulus_for_env.sh', 'alpha', 'nomulus'] +# Build and package the deployment files for crash. - name: 'gcr.io/${PROJECT_ID}/builder:latest' - entrypoint: bin/bash - args: ['./move_artifacts.sh', 'sandbox', 'nomulus'] -# Build the deployment files for crash. + args: ['release/build_nomulus_for_env.sh', 'crash', 'nomulus'] +# Build and package the deployment files for sandbox. - name: 'gcr.io/${PROJECT_ID}/builder:latest' - args: - - './gradlew' - - 'stage' - - '-x' - - 'autoLintGradle' - - '-Penvironment=crash' - - '-PmavenUrl=gcs://domain-registry-maven-repository/maven' - - '-PpluginsUrl=gcs://domain-registry-maven-repository/plugins' - dir: 'gradle' + args: ['release/build_nomulus_for_env.sh', 'sandbox', 'nomulus'] +# Build and package the deployment files for production. - name: 'gcr.io/${PROJECT_ID}/builder:latest' - entrypoint: bin/bash - args: ['./move_artifacts.sh', 'crash', 'nomulus'] -# Create the uber tarball including all environments. -- name: 'gcr.io/${PROJECT_ID}/builder:latest' - entrypoint: bin/bash - args: ['tar', 'cvf', '../nomulus.tar', '.'] - dir: 'nomulus' -# The tarball to upload to GCS. + args: ['release/build_nomulus_for_env.sh', 'production', 'nomulus'] +# The tarballs to upload to GCS. artifacts: objects: location: 'gs://${PROJECT_ID}-deploy/${TAG_NAME}' - paths: ['nomulus.tar'] + paths: + - 'alpha.tar' + - 'crash.tar' + - 'sandbox.tar' + - 'production.tar' timeout: 3600s options: machineType: 'N1_HIGHCPU_8' diff --git a/release/cloudbuild-proxy.yaml b/release/cloudbuild-proxy.yaml index 6239974b1..3ce239715 100644 --- a/release/cloudbuild-proxy.yaml +++ b/release/cloudbuild-proxy.yaml @@ -24,8 +24,6 @@ steps: - './gradlew' - ':proxy:test' - ':proxy:deployJar' - - '-x' - - 'autoLintGradle' - '-PmavenUrl=https://storage.googleapis.com/domain-registry-maven-repository/maven' - '-PpluginsUrl=https://storage.googleapis.com/domain-registry-maven-repository/plugins' dir: 'gradle'