sparse-intern-71089
02/20/2020, 10:56 AMsteep-caravan-65104
02/20/2020, 10:59 AMidentity
.
2. In Google Cloud Build, we are running cloud build steps from a cloudbuild.yaml
file present in the sub-directory, i.e. from identity/cloudbuild.yaml
.
3. The identity/cloudbuild.yaml
file looks like the following:
steps:
- name: "<http://gcr.io/cloud-builders/docker|gcr.io/cloud-builders/docker>"
args: [ "build", "-t", "<http://asia.gcr.io/$PROJECT_ID/|asia.gcr.io/$PROJECT_ID/><repo-name>:$COMMIT_SHA", "."]
- name: "<http://gcr.io/cloud-builders/docker|gcr.io/cloud-builders/docker>"
args: ["push", "<http://asia.gcr.io/$PROJECT_ID/|asia.gcr.io/$PROJECT_ID/><repo-name>:$COMMIT_SHA"]
- name: '<http://asia.gcr.io/$PROJECT_ID/|asia.gcr.io/$PROJECT_ID/><repo-name>:$COMMIT_SHA'
entrypoint: /bin/bash
args:
- '-c'
- "export BUILD_TYPE=${_BUILD_TYPE} && make ci-login && make ci-up"
env:
- 'PROJECT=identity'
- 'ENV=prod'
secretEnv: ["GOOGLE_CREDENTIALS"]
secrets:
- kmsKeyName: <path-to-key>
secretEnv:
GOOGLE_CREDENTIALS: <REDACTED>
Note that do run yarn install
in the Dockerfile:
FROM pulumi/pulumi
WORKDIR /workspace
COPY . .
# add other projects later
RUN yarn --cwd ./identity --frozen-lockfile install
And the Makefile
(present in the root of the repo) has the following make
commands called from the cloud build file above:
ci-login:
pulumi login <path-to-bucket>
ci-up:
ifeq ($(BUILD_TYPE),preview)
pulumi preview --cwd=$(PWD)/$(PROJECT) --stack=$(PROJECT)-$(ENV) --refresh --non-interactive
else
pulumi up --cwd=$(PWD)/$(PROJECT) --stack=$(PROJECT)-$(ENV) --refresh --non-interactive
endif
_BUILD_TYPE
is specified with the value preview
in the Google Cloud Build trigger configuration as per the official instructions from https://www.pulumi.com/docs/guides/continuous-delivery/google-cloud-build/gentle-diamond-70147
02/20/2020, 4:00 PM$(PWD)/$(PROJECT)
in your Makefile the same path as ./identity
as in the Dockerfile?gentle-diamond-70147
02/20/2020, 4:00 PMtree
or ls -al node_modules
in one of them to help troubleshoot and see if the yarn install is installing to the expected location.steep-caravan-65104
02/21/2020, 12:19 PMnode_modules
subdirectory was installed to the /identity
directory of the docker container. But by default, Google Cloud Build mounts the host filesystem (without node_modules
) to /workspace
of the docker container and then the current working directory was specified as /workspace
in the Dockerfile.