Skip to content

Commit

Permalink
chore(builds/containers): Enable moving builds to spinnaker-community…
Browse files Browse the repository at this point in the history
… GCP project (#7)
  • Loading branch information
Travis Tomsu authored Feb 13, 2020
1 parent 18bb1ec commit b0c5d24
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,5 @@ dmypy.json

# Pyre type checker
.pyre/

.idea/
20 changes: 10 additions & 10 deletions dev/buildtool/cloudbuild-build-java8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ steps:
name: gcr.io/cloud-builders/docker
args: [
"build",
"-t", "gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME",
"-t", "gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-slim",
"-t", "$_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME",
"-t", "$_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-slim",
"-f", "Dockerfile.slim",
".",
]
Expand All @@ -23,7 +23,7 @@ steps:
name: gcr.io/cloud-builders/docker
args: [
"build",
"-t", "gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-ubuntu",
"-t", "$_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-ubuntu",
"-f", "Dockerfile.ubuntu",
".",
]
Expand All @@ -32,7 +32,7 @@ steps:
name: gcr.io/cloud-builders/docker
args: [
"build",
"-t", "gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-java8",
"-t", "$_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-java8",
"-f", "Dockerfile.java8",
".",
]
Expand All @@ -41,16 +41,16 @@ steps:
name: gcr.io/cloud-builders/docker
args: [
"build",
"-t", "gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-ubuntu-java8",
"-t", "$_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-ubuntu-java8",
"-f", "Dockerfile.ubuntu-java8",
".",
]
images:
- gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME
- gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-slim
- gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-java8
- gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-ubuntu
- gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-ubuntu-java8
- $_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME
- $_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-slim
- $_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-java8
- $_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-ubuntu
- $_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-ubuntu-java8
timeout: 3600s
options:
machineType: N1_HIGHCPU_8
20 changes: 10 additions & 10 deletions dev/buildtool/cloudbuild-tag-java8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ steps:
name: gcr.io/cloud-builders/docker
args: [
"build",
"-t", "gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME",
"-t", "gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-slim",
"-t", "gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-java8",
"-t", "$_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME",
"-t", "$_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-slim",
"-t", "$_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-java8",
"-f", "Dockerfile.slim",
".",
]
Expand All @@ -24,17 +24,17 @@ steps:
name: gcr.io/cloud-builders/docker
args: [
"build",
"-t", "gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-ubuntu",
"-t", "gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-ubuntu-java8",
"-t", "$_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-ubuntu",
"-t", "$_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-ubuntu-java8",
"-f", "Dockerfile.ubuntu",
".",
]
images:
- gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME
- gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-slim
- gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-java8
- gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-ubuntu
- gcr.io/$PROJECT_ID/$_IMAGE_NAME:$TAG_NAME-ubuntu-java8
- $_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME
- $_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-slim
- $_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-java8
- $_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-ubuntu
- $_DOCKER_REGISTRY/$_IMAGE_NAME:$TAG_NAME-ubuntu-java8
timeout: 3600s
options:
machineType: N1_HIGHCPU_8
5 changes: 3 additions & 2 deletions dev/buildtool/container_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ def __build_with_gcb(self, repository, build_version):
# Note this command assumes a cwd of git_dir
command = ('gcloud builds submit '
' --account={account} --project={project}'
' --substitutions=TAG_NAME={tag_name},_IMAGE_NAME={image_name}'
' --substitutions=TAG_NAME={tag_name},_IMAGE_NAME={image_name},_DOCKER_REGISTRY={docker_registry}'
' --config={cloudbuild_config} .'
.format(account=options.gcb_service_account,
project=options.gcb_project,
docker_registry=options.docker_registry,
tag_name=build_version,
image_name=service_name,
cloudbuild_config=cloudbuild_config))
Expand Down Expand Up @@ -136,7 +137,7 @@ def init_argparser(self, parser, defaults):
self.add_bom_parser_args(parser, defaults)
self.add_argument(
parser, 'gcb_project', defaults, None,
help='The GCP project ID to publish containers to when'
help='The GCP project ID that builds the containers when'
' using Google Container Builder.')
self.add_argument(
parser, 'gcb_service_account', defaults, None,
Expand Down

0 comments on commit b0c5d24

Please sign in to comment.