Skip to content

Commit 80e223a

Browse files
author
JR Conlin
authored
1 parent a374a04 commit 80e223a

1 file changed

Lines changed: 89 additions & 5 deletions

File tree

.circleci/config.yml

Lines changed: 89 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
# GCP_OIDC_SERVICE_ACCOUNT_EMAIL - GCP service account email
1717
# GCP_OIDC_WIP_ID - GCP Workload Identity Pool ID
1818
# GCP_OIDC_WIP_PROVIDER_ID - GCP Workload Identity Pool Provider ID
19+
# GCP_GAR_ENTERPRISE_PROJECT_ID - GCP project ID for enterprise GAR repo (if different from GCP_GAR_PROJECT_ID)
20+
# GCP_GAR_ENTERPRISE_REPO - Name of enterprise GAR repo (if different from GCP_GAR_REPO)
21+
#
22+
# Note: You can locally debug/validate the generated yaml file using the CircleCI CLI tool.
23+
# use the command: `circleci config process .circleci/config.yml > out.yml`. This will generate
24+
# the final yaml file that CircleCI uses after processing all orbs, parameters, and commands.
1925

2026
version: 2.1
2127

@@ -335,6 +341,9 @@ jobs:
335341
type: string
336342
binary:
337343
type: string
344+
build_args:
345+
type: string
346+
default: ""
338347
steps:
339348
# Install these packages before checkout because git may not exist or work
340349
- run:
@@ -357,6 +366,7 @@ jobs:
357366
name: Build Docker image
358367
command: |
359368
docker build -t <<parameters.image>> \
369+
--build-arg BUILD_ARGS=<<parameters.build_args>> \
360370
--build-arg CRATE=<<parameters.crate>> \
361371
--build-arg BINARY=<<parameters.binary>> .
362372
# save the built docker container into CircleCI's workspace cache. This is
@@ -410,6 +420,9 @@ jobs:
410420
type: string
411421
path:
412422
type: string
423+
build_args:
424+
type: string
425+
default: ""
413426
steps:
414427
- checkout
415428
- setup_remote_docker:
@@ -435,6 +448,9 @@ jobs:
435448
type: string
436449
path:
437450
type: string
451+
build_args:
452+
type: string
453+
default: ""
438454
steps:
439455
- checkout
440456
- setup_remote_docker:
@@ -467,12 +483,18 @@ jobs:
467483
registry-url:
468484
type: string
469485
default: us-docker.pkg.dev
486+
project_id:
487+
type: string
488+
default: GCP_GAR_PROJECT_ID
489+
repo:
490+
type: string
491+
default: GCP_GAR_REPO
470492
steps:
471493
# gcr-auth parameters:
472494
# https://circleci.com/developer/orbs/orb/circleci/gcp-gcr#commands-gcr-auth
473495
- gcp-gcr/gcr-auth:
474496
gcp_cred_config_file_path: ~/gcp_cred_config.json
475-
google-project-id: GCP_GAR_PROJECT_ID
497+
google-project-id: <<parameters.project_id>>
476498
google_project_number: GCP_OIDC_PROJECT_NUMBER
477499
registry-url: <<parameters.registry-url>>
478500
service_account_email: GCP_OIDC_SERVICE_ACCOUNT_EMAIL
@@ -498,15 +520,15 @@ jobs:
498520
else
499521
echo "export GAR_TAG=${CIRCLE_BRANCH}" >> $BASH_ENV
500522
fi
501-
echo "export GAR_IMAGE=\"<<parameters.registry-url>>/${GCP_GAR_PROJECT_ID}/${GCP_GAR_REPO}/<<parameters.image>>\"" >> $BASH_ENV
523+
echo "export GAR_IMAGE=\"<<parameters.registry-url>>/${<<parameters.project_id>>}/${<<parameters.repo>>}/<<parameters.image>>\"" >> $BASH_ENV
502524
source $BASH_ENV
503525
docker tag <<parameters.image>> $GAR_IMAGE:$GAR_TAG
504526
docker tag <<parameters.image>> $GAR_IMAGE:latest
505527
# push-image parameters:
506528
# https://circleci.com/developer/orbs/orb/circleci/gcp-gcr#commands-push-image
507529
- gcp-gcr/push-image:
508-
image: "${GCP_GAR_REPO}/<<parameters.image>>"
509-
google-project-id: GCP_GAR_PROJECT_ID
530+
image: "<<parameters.repo>>/<<parameters.image>>"
531+
google-project-id: <<parameters.project_id>>
510532
registry-url: <<parameters.registry-url>>
511533
tag: $GAR_TAG,latest
512534

@@ -555,6 +577,24 @@ workflows:
555577
filters:
556578
tags:
557579
only: /.*/
580+
- build:
581+
name: build-autoconnect-enterprise
582+
image: autoconnect-enterprise
583+
crate: autoconnect
584+
binary: autoconnect
585+
build_args: "\"--no-default-features --features=redis\""
586+
filters:
587+
tags:
588+
only: /.*/
589+
- build:
590+
name: build-autoendpoint-enterprise
591+
image: autoendpoint-enterprise
592+
crate: autoendpoint
593+
binary: autoendpoint
594+
build_args: "\"--no-default-features --features=redis\""
595+
filters:
596+
tags:
597+
only: /.*/
558598

559599
- build-reliability-cron:
560600
name: build-reliability-cron
@@ -590,10 +630,13 @@ workflows:
590630
tags:
591631
only: /.*/
592632

593-
# Comment out the following three sections for local CircleCI testing.
633+
# Comment out the following five sections for local CircleCI testing.
634+
# vvvv
594635
- deploy:
595636
name: deploy-autoconnect
596637
image: autoconnect
638+
project_id: GCP_GAR_PROJECT_ID
639+
repo: GCP_GAR_REPO
597640
requires:
598641
- build-autoconnect
599642
- Unit Tests
@@ -608,6 +651,8 @@ workflows:
608651
- deploy:
609652
name: deploy-autoendpoint
610653
image: autoendpoint
654+
project_id: GCP_GAR_PROJECT_ID
655+
repo: GCP_GAR_REPO
611656
requires:
612657
- build-autoendpoint
613658
- Unit Tests
@@ -630,6 +675,45 @@ workflows:
630675
branches:
631676
only: master
632677

678+
- deploy:
679+
name: deploy-autoconnect-enterprise
680+
image: autoconnect-enterprise
681+
project_id: GCP_GAR_ENTERPRISE_PROJECT_ID
682+
repo: GCP_GAR_ENTERPRISE_REPO
683+
requires:
684+
- build-autoconnect-enterprise
685+
- Unit Tests
686+
- Integration Tests
687+
- Rust Formatting Check
688+
filters:
689+
tags:
690+
only: /.*/
691+
branches:
692+
only:
693+
- master
694+
- enterprise
695+
696+
- deploy:
697+
name: deploy-autoendpoint-enterprise
698+
image: autoendpoint-enterprise
699+
project_id: GCP_GAR_ENTERPRISE_PROJECT_ID
700+
repo: GCP_GAR_ENTERPRISE_REPO
701+
requires:
702+
- build-autoendpoint-enterprise
703+
- Unit Tests
704+
- Integration Tests
705+
- Rust Formatting Check
706+
filters:
707+
tags:
708+
only: /.*/
709+
branches:
710+
only:
711+
- master
712+
- enterprise
713+
714+
# ^^^^
715+
# End comment for local CircleCI testing.
716+
633717
- deploy:
634718
name: Push Load Test Image
635719
image: autopush-load-tests

0 commit comments

Comments
 (0)