From 721ed516a442c90a7641670c62daebff053bc704 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Wed, 10 Jun 2020 07:14:34 -0400 Subject: [PATCH] Separate folder for templating collection stuff --- .gitignore | 1 + Makefile | 4 +-- awx_collection/galaxy.yml | 2 +- .../roles/template_galaxy/tasks/main.yml | 2 +- .../template_galaxy/templates/galaxy.yml.j2 | 2 +- awx_collection/tools/template_galaxy.yml | 30 ++++++++++++++++++- 6 files changed, 35 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 2bdcfc7bd1..37727320b1 100644 --- a/.gitignore +++ b/.gitignore @@ -140,6 +140,7 @@ use_dev_supervisor.txt /awx_collection_test_venv/ /awx_collection/*.tar.gz /sanity/ +/awx_collection_build/ .idea/* *.unison.tmp diff --git a/Makefile b/Makefile index 70537cf249..ac2b209b1d 100644 --- a/Makefile +++ b/Makefile @@ -401,11 +401,11 @@ symlink_collection: build_collection: ansible-playbook -i localhost, awx_collection/tools/template_galaxy.yml -e collection_package=$(COLLECTION_PACKAGE) -e collection_namespace=$(COLLECTION_NAMESPACE) -e collection_version=$(VERSION) -e '{"awx_template_version":false}' - ansible-galaxy collection build awx_collection --force --output-path=awx_collection + ansible-galaxy collection build awx_collection_build --force --output-path=awx_collection_build install_collection: build_collection rm -rf $(COLLECTION_INSTALL) - ansible-galaxy collection install awx_collection/$(COLLECTION_NAMESPACE)-$(COLLECTION_PACKAGE)-$(VERSION).tar.gz + ansible-galaxy collection install awx_collection_build/$(COLLECTION_NAMESPACE)-$(COLLECTION_PACKAGE)-$(VERSION).tar.gz test_collection_sanity: install_collection cd $(COLLECTION_INSTALL) && ansible-test sanity diff --git a/awx_collection/galaxy.yml b/awx_collection/galaxy.yml index 7ee3600379..e0f8883b5f 100644 --- a/awx_collection/galaxy.yml +++ b/awx_collection/galaxy.yml @@ -17,7 +17,7 @@ tags: - awx - ansible - automation -version: 11.2.0 +version: devel build_ignore: - tools - setup.cfg diff --git a/awx_collection/tools/roles/template_galaxy/tasks/main.yml b/awx_collection/tools/roles/template_galaxy/tasks/main.yml index fc56f54e6d..d2f7b2929d 100644 --- a/awx_collection/tools/roles/template_galaxy/tasks/main.yml +++ b/awx_collection/tools/roles/template_galaxy/tasks/main.yml @@ -46,7 +46,7 @@ dest: "{{ collection_path }}/galaxy.yml" force: true -- name: Tempalte the README.md file +- name: Template the README.md file template: src: "{{ collection_path }}/tools/roles/template_galaxy/templates/README.md.j2" dest: "{{ collection_path }}/README.md" diff --git a/awx_collection/tools/roles/template_galaxy/templates/galaxy.yml.j2 b/awx_collection/tools/roles/template_galaxy/templates/galaxy.yml.j2 index b2a00538d7..b022fd7c30 100644 --- a/awx_collection/tools/roles/template_galaxy/templates/galaxy.yml.j2 +++ b/awx_collection/tools/roles/template_galaxy/templates/galaxy.yml.j2 @@ -17,7 +17,7 @@ tags: - awx - ansible - automation -version: {{ collection_version }} +version: {{ collection_version_override | default(collection_version) }} build_ignore: - tools - setup.cfg diff --git a/awx_collection/tools/template_galaxy.yml b/awx_collection/tools/template_galaxy.yml index 78b69cfa5f..2bfb83aa11 100644 --- a/awx_collection/tools/template_galaxy.yml +++ b/awx_collection/tools/template_galaxy.yml @@ -7,6 +7,34 @@ collection_package: awx collection_namespace: awx collection_version: 0.0.1 # not for updating, pass in extra_vars - collection_path: "{{ playbook_dir }}/../" + collection_source: "{{ playbook_dir }}/../" + collection_path: "{{ playbook_dir }}/../../awx_collection_build" + pre_tasks: + - file: + path: "{{ collection_path }}" + state: absent + + - copy: + src: "{{ collection_source }}" + dest: "{{ collection_path }}" + remote_src: true + roles: - template_galaxy + + tasks: + - name: Make substitutions in source to sync with templates + set_fact: + collection_version_override: devel + + - name: Template the galaxy.yml file + template: + src: "{{ collection_source }}/tools/roles/template_galaxy/templates/galaxy.yml.j2" + dest: "{{ collection_source }}/galaxy.yml" + force: true + + - name: Template the README.md file + template: + src: "{{ collection_source }}/tools/roles/template_galaxy/templates/README.md.j2" + dest: "{{ collection_source }}/README.md" + force: true