Update Nomulus release pipeline

Refactor out the build and package logic to a reusable script. Also removed the gradle task flag to skip lint check, as failing lint check is no longer a fatal error.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=245296563
This commit is contained in:
jianglai 2019-04-25 13:29:30 -07:00
parent 4895f455d8
commit 94aa5cd6ec
3 changed files with 34 additions and 41 deletions

View file

@ -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 <destination>"
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 -

View file

@ -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'

View file

@ -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'