Trying to create 1 job that will use the same executor, but build and push multiple images based on different dockerfiles located in different directories within my repo.
I’m using the GCR orb, and i’ve tried using matrices with the following config:
jobs:
build-and-push:
executor: gcp-gcr/default
parameters:
path:
type:string
steps:
- checkout
- gcp-gcr/gcr-auth
- gcp-gcr/build-image:
image: jre-test
no_output_timeout: 20m
registry-url: gcr.io/my-gcr/
path: path
- gcp-gcr/push-image:
digest-path: /tmp/digest.txt
image:j re-test
registry-url: gcr.io/my-gcr/
- run:
command: |
echo "Digest is: $(</tmp/digest.txt)"
orbs:
gcp-gcr: circleci/gcp-gcr@0.13.0
version: 2.1
workflows:
commit:
jobs:
- build-and-push-<< matrix.path >>
matrix:
parameters:
path: [jre]
My repo is structured with a jre directory, and inside that is a Dockerfile.
I’m just trying to get a single image to work first, and then i’ll add more directories/images afterwords. I was going to add multiple Dockerfiles inside the jre directory. For different operating systems.
The goal here is to schedule the job to run regularly, and have it build a new version of the Dockerfiles and upload it to our registry.
I’d like to use native circle yml, and not write a build script that parses the directories and does all the commands that the orb is doing. Tho i’m beginning to think the gcp-gcr orb is holding me back a bit.
Currently the above job fails with "
matrix:
in 'string', line 30, column 15:
mapping values are not allowed here
Unable to parse YAML