From f9f0d1d37766e4fe9cf5fa2aea7fb72bfa44d518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Job=20C=C3=A9spedes=20Ortiz?= Date: Wed, 8 Sep 2021 20:55:13 -0600 Subject: [PATCH 1/2] refactor: use ansible collection updatebot reference --- .../inventory/group_vars/all/dockerfile_builder.yml | 4 ++-- .ansible-ci/tasks/updatebot.yml | 4 ++-- ...4e.yaml.j2 => updatebot-ansible-collection.yaml.j2} | 10 ++++++++++ .ansible-ci/vars/pipeline/release.yml | 2 +- .lighthouse/jenkins-x/release.yaml | 4 ++-- ...ebot-m4e.yaml => updatebot-ansible-collection.yaml} | 0 6 files changed, 17 insertions(+), 7 deletions(-) rename .ansible-ci/templates/{updatebot-m4e.yaml.j2 => updatebot-ansible-collection.yaml.j2} (75%) rename .lighthouse/{updatebot-m4e.yaml => updatebot-ansible-collection.yaml} (100%) diff --git a/.ansible-ci/inventory/group_vars/all/dockerfile_builder.yml b/.ansible-ci/inventory/group_vars/all/dockerfile_builder.yml index d08ec14d..6bfab5dc 100644 --- a/.ansible-ci/inventory/group_vars/all/dockerfile_builder.yml +++ b/.ansible-ci/inventory/group_vars/all/dockerfile_builder.yml @@ -53,5 +53,5 @@ doc_project_readme_src: README.md.j2 doc_project_readme_dest: "{{ git_repo_dir }}/README.md" # updatebot -updatebot_m4e_template_src: updatebot-m4e.yaml.j2 -updatebot_m4e_template_dest: "{{ git_repo_dir }}/.lighthouse/updatebot-m4e.yaml" +updatebot_ansible_collection_template_src: updatebot-ansible-collection.yaml.j2 +updatebot_ansible_collection_template_dest: "{{ git_repo_dir }}/.lighthouse/updatebot-ansible-collection.yaml" diff --git a/.ansible-ci/tasks/updatebot.yml b/.ansible-ci/tasks/updatebot.yml index 1fb7c1ad..133b84f0 100644 --- a/.ansible-ci/tasks/updatebot.yml +++ b/.ansible-ci/tasks/updatebot.yml @@ -6,6 +6,6 @@ when: - "'moodle_web' in ansible_play_hosts_all or 'postgres' in ansible_play_hosts_all" template: - src: "{{ updatebot_m4e_template_src }}" - dest: "{{ updatebot_m4e_template_dest }}" + src: "{{ updatebot_ansible_collection_template_src }}" + dest: "{{ updatebot_ansible_collection_template_dest }}" mode: '0644' diff --git a/.ansible-ci/templates/updatebot-m4e.yaml.j2 b/.ansible-ci/templates/updatebot-ansible-collection.yaml.j2 similarity index 75% rename from .ansible-ci/templates/updatebot-m4e.yaml.j2 rename to .ansible-ci/templates/updatebot-ansible-collection.yaml.j2 index bcf58be3..bb0baa94 100644 --- a/.ansible-ci/templates/updatebot-m4e.yaml.j2 +++ b/.ansible-ci/templates/updatebot-ansible-collection.yaml.j2 @@ -35,3 +35,13 @@ spec: sed -i \ "s#^nginx_image:.*#nginx_image: ${nginx_image//@/\\@}#" \ roles/v1alpha1/web/nginx/defaults/main/nginx.yml + - command: + # update Graphql Engine image and its tag + name: bash + args: + - -c + - | + graphql_engine_image='{{ hostvars['graphql-engine'].state_yml_repo_digest }}' + sed -i \ + "s#^graphql_engine_image:.*#graphql_engine_image: ${graphql_engine_image//@/\\@}#" \ + roles/v1alpha1/app/g12e/defaults/main/graphql-engine.yml diff --git a/.ansible-ci/vars/pipeline/release.yml b/.ansible-ci/vars/pipeline/release.yml index 9df96aa7..c08d4cc8 100644 --- a/.ansible-ci/vars/pipeline/release.yml +++ b/.ansible-ci/vars/pipeline/release.yml @@ -1,7 +1,7 @@ version_include_major_minor_tags: true build_image_name: "{{ build_registry_path }}/{{ ansible_host }}" git_add_path: - "'{{ state_file }}' '{{ dockerfile_builder_path }}' '{{ doc_project_readme_dest }}' '{{ updatebot_m4e_template_dest }}'" + "'{{ state_file }}' '{{ dockerfile_builder_path }}' '{{ doc_project_readme_dest }}' '{{ updatebot_ansible_collection_template_dest }}'" git_add_throttle: 1 git_commit_msgs: - "chore(release): {{ release_version }}" diff --git a/.lighthouse/jenkins-x/release.yaml b/.lighthouse/jenkins-x/release.yaml index 4f686d20..4fb3c267 100755 --- a/.lighthouse/jenkins-x/release.yaml +++ b/.lighthouse/jenkins-x/release.yaml @@ -59,8 +59,8 @@ spec: # promote if a new commit is made during pipeline if [[ ! -z ${HEAD_COMMIT} && ! -z ${PULL_BASE_SHA} && "${HEAD_COMMIT}" != "${PULL_BASE_SHA}" ]]; then - jx-updatebot pr -c .lighthouse/updatebot-m4e.yaml \ - --commit-title "chore(m4e): bump image versions with updatebot" \ + jx-updatebot pr -c .lighthouse/updatebot-ansible-collection.yaml \ + --commit-title "chore: bump image versions in ansible collection with updatebot" \ --no-version else echo "not promoted" diff --git a/.lighthouse/updatebot-m4e.yaml b/.lighthouse/updatebot-ansible-collection.yaml similarity index 100% rename from .lighthouse/updatebot-m4e.yaml rename to .lighthouse/updatebot-ansible-collection.yaml From 4f8a269d15085524169c52f93d03e559aafe259f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Job=20C=C3=A9spedes=20Ortiz?= Date: Wed, 8 Sep 2021 21:11:20 -0600 Subject: [PATCH 2/2] feat: promote artifact tag as an image tag during a release --- .ansible-ci/vars/pipeline/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ansible-ci/vars/pipeline/release.yml b/.ansible-ci/vars/pipeline/release.yml index c08d4cc8..cd7db238 100644 --- a/.ansible-ci/vars/pipeline/release.yml +++ b/.ansible-ci/vars/pipeline/release.yml @@ -9,6 +9,8 @@ git_commit_msgs: pr_commit_tag: "{{ lookup('pipe', 'git rev-parse HEAD^2 &>/dev/null && git rev-parse HEAD^2 || echo') | default(false,true)}}" artifact_tag: "{{ pr_commit_tag }}" +dockerfile_builder_tags: + - "{{ artifact_tag }}" git_push_options: --tags git_tag: "v{{ release_version }}" release_version: "{{ next_version | default(false,true) }}"