Skip to content

Commit

Permalink
gitlab workflow fixes #2401 (#2402)
Browse files Browse the repository at this point in the history
Co-authored-by: Ludovico Magnocavallo <[email protected]>
  • Loading branch information
sudhirrs and ludoo authored Jul 1, 2024
1 parent e58c1b8 commit 3bb03c9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
11 changes: 9 additions & 2 deletions fast/assets/templates/workflow-gitlab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ workflow:
variables:
COMMAND: apply
FAST_SERVICE_ACCOUNT: ${service_accounts.apply}
TF_PROVIDERS_FILE: 0-bootstrap-providers.tf
TF_PROVIDERS_FILE: ${tf_providers_files.apply}
# pr / plan
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
variables:
COMMAND: plan
FAST_SERVICE_ACCOUNT: ${service_accounts.plan}
TF_PROVIDERS_FILE: 0-bootstrap-r-providers.tf
TF_PROVIDERS_FILE: ${tf_providers_files.plan}

stages:
- gcp-setup
Expand All @@ -50,6 +50,9 @@ gcp-setup:
paths:
- cicd-sa-credentials.json
- providers.tf
%{~ for f in tf_var_files ~}
- ${f}
%{~ endfor ~}
id_tokens:
GITLAB_TOKEN:
aud:
Expand All @@ -68,6 +71,10 @@ gcp-setup:
--credential-source-file=token.txt
- gcloud config set auth/credential_file_override $GOOGLE_CREDENTIALS
- gcloud alpha storage cp -r "gs://$FAST_OUTPUTS_BUCKET/providers/$TF_PROVIDERS_FILE" ./providers.tf
%{~ for f in tf_var_files ~}
- gcloud alpha storage cp gs://$FAST_OUTPUTS_BUCKET/tfvars/${f} ./
%{~ endfor ~}


tf-plan-apply:
stage: tf-plan-apply
Expand Down
11 changes: 9 additions & 2 deletions fast/stages/0-bootstrap/templates/workflow-gitlab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ workflow:
variables:
COMMAND: apply
FAST_SERVICE_ACCOUNT: ${service_accounts.apply}
TF_PROVIDERS_FILE: 0-bootstrap-providers.tf
TF_PROVIDERS_FILE: ${tf_providers_files.apply}
# pr / plan
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
variables:
COMMAND: plan
FAST_SERVICE_ACCOUNT: ${service_accounts.plan}
TF_PROVIDERS_FILE: 0-bootstrap-r-providers.tf
TF_PROVIDERS_FILE: ${tf_providers_files.plan}

stages:
- gcp-setup
Expand All @@ -50,6 +50,9 @@ gcp-setup:
paths:
- cicd-sa-credentials.json
- providers.tf
%{~ for f in tf_var_files ~}
- ${f}
%{~ endfor ~}
id_tokens:
GITLAB_TOKEN:
aud:
Expand All @@ -68,6 +71,10 @@ gcp-setup:
--credential-source-file=token.txt
- gcloud config set auth/credential_file_override $GOOGLE_CREDENTIALS
- gcloud alpha storage cp -r "gs://$FAST_OUTPUTS_BUCKET/providers/$TF_PROVIDERS_FILE" ./providers.tf
%{~ for f in tf_var_files ~}
- gcloud alpha storage cp gs://$FAST_OUTPUTS_BUCKET/tfvars/${f} ./
%{~ endfor ~}


tf-plan-apply:
stage: tf-plan-apply
Expand Down
11 changes: 9 additions & 2 deletions fast/stages/1-resman/templates/workflow-gitlab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ workflow:
variables:
COMMAND: apply
FAST_SERVICE_ACCOUNT: ${service_accounts.apply}
TF_PROVIDERS_FILE: 0-bootstrap-providers.tf
TF_PROVIDERS_FILE: ${tf_providers_files.apply}
# pr / plan
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
variables:
COMMAND: plan
FAST_SERVICE_ACCOUNT: ${service_accounts.plan}
TF_PROVIDERS_FILE: 0-bootstrap-r-providers.tf
TF_PROVIDERS_FILE: ${tf_providers_files.plan}

stages:
- gcp-setup
Expand All @@ -50,6 +50,9 @@ gcp-setup:
paths:
- cicd-sa-credentials.json
- providers.tf
%{~ for f in tf_var_files ~}
- ${f}
%{~ endfor ~}
id_tokens:
GITLAB_TOKEN:
aud:
Expand All @@ -68,6 +71,10 @@ gcp-setup:
--credential-source-file=token.txt
- gcloud config set auth/credential_file_override $GOOGLE_CREDENTIALS
- gcloud alpha storage cp -r "gs://$FAST_OUTPUTS_BUCKET/providers/$TF_PROVIDERS_FILE" ./providers.tf
%{~ for f in tf_var_files ~}
- gcloud alpha storage cp gs://$FAST_OUTPUTS_BUCKET/tfvars/${f} ./
%{~ endfor ~}


tf-plan-apply:
stage: tf-plan-apply
Expand Down
11 changes: 9 additions & 2 deletions fast/stages/1-tenant-factory/templates/workflow-gitlab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ workflow:
variables:
COMMAND: apply
FAST_SERVICE_ACCOUNT: ${service_accounts.apply}
TF_PROVIDERS_FILE: 0-bootstrap-providers.tf
TF_PROVIDERS_FILE: ${tf_providers_files.apply}
# pr / plan
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
variables:
COMMAND: plan
FAST_SERVICE_ACCOUNT: ${service_accounts.plan}
TF_PROVIDERS_FILE: 0-bootstrap-r-providers.tf
TF_PROVIDERS_FILE: ${tf_providers_files.plan}

stages:
- gcp-setup
Expand All @@ -50,6 +50,9 @@ gcp-setup:
paths:
- cicd-sa-credentials.json
- providers.tf
%{~ for f in tf_var_files ~}
- ${f}
%{~ endfor ~}
id_tokens:
GITLAB_TOKEN:
aud:
Expand All @@ -68,6 +71,10 @@ gcp-setup:
--credential-source-file=token.txt
- gcloud config set auth/credential_file_override $GOOGLE_CREDENTIALS
- gcloud alpha storage cp -r "gs://$FAST_OUTPUTS_BUCKET/providers/$TF_PROVIDERS_FILE" ./providers.tf
%{~ for f in tf_var_files ~}
- gcloud alpha storage cp gs://$FAST_OUTPUTS_BUCKET/tfvars/${f} ./
%{~ endfor ~}


tf-plan-apply:
stage: tf-plan-apply
Expand Down

0 comments on commit 3bb03c9

Please sign in to comment.