From 771d80184a09b8772446007eca6674a9ac93f7dd Mon Sep 17 00:00:00 2001 From: Thomas Auffredou Date: Wed, 5 Feb 2020 14:05:53 +0100 Subject: [PATCH 1/2] Fix runners.cache.s3 section s3 and gcs cache sections both "haveBucketName" directive. Either "Set cache s3 bucket name option" or "Set cache gcs bucket name" can be run or the gcs task will override the s3 config. --- tasks/update-config-runner.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/update-config-runner.yml b/tasks/update-config-runner.yml index 61523a1..6a3822f 100644 --- a/tasks/update-config-runner.yml +++ b/tasks/update-config-runner.yml @@ -225,6 +225,7 @@ backrefs: no check_mode: no notify: restart_gitlab_runner + when: gitlab_runner.cache_type == 's3' - name: Set cache s3 bucket location option lineinfile: @@ -260,6 +261,7 @@ backrefs: no check_mode: no notify: restart_gitlab_runner + when: gitlab_runner.cache_type == 'gcs' - name: Set cache gcs credentials file lineinfile: @@ -351,7 +353,6 @@ check_mode: no notify: restart_gitlab_runner - - name: Set builds dir file option lineinfile: dest: "{{ temp_runner_config.path }}" From 6bda94a80296c639d3da284a2f991a5bc726006f Mon Sep 17 00:00:00 2001 From: Thomas Auffredou Date: Wed, 5 Feb 2020 14:07:03 +0100 Subject: [PATCH 2/2] Add runners.cache.s3 section when cache_type is s3 --- tasks/update-config-runner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/update-config-runner.yml b/tasks/update-config-runner.yml index 6a3822f..e31f0b7 100644 --- a/tasks/update-config-runner.yml +++ b/tasks/update-config-runner.yml @@ -130,7 +130,7 @@ dest: "{{ temp_runner_config.path }}" regexp: '^\s*\[runners\.cache\.s3\]' line: ' [runners.cache.s3]' - state: "{{ 'present' if gitlab_runner.cache_s3_server_address is defined else 'absent' }}" + state: "{{ 'present' if gitlab_runner.cache_type == 's3' else 'absent' }}" insertafter: '^\s*\[runners\.cache\]' backrefs: no check_mode: no