Add auto releasing job for tripleo-operators collection
Change-Id: Ib560421dee52afe4a70a0289da2ae58d0788cb8d
This commit is contained in:
parent
d7be1b9a8c
commit
95c0c40cac
@ -32,7 +32,7 @@ repos:
|
|||||||
- 'ansible<2.10'
|
- 'ansible<2.10'
|
||||||
files: \.(yaml|yml)$
|
files: \.(yaml|yml)$
|
||||||
entry: >-
|
entry: >-
|
||||||
ansible-lint --force-color -v -x "ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016"
|
ansible-lint --force-color -v -x "ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016" --exclude zuul.d/
|
||||||
# TODO(cloudnull): These codes were added to pass the lint check.
|
# TODO(cloudnull): These codes were added to pass the lint check.
|
||||||
# Things found within roles.galaxy are external
|
# Things found within roles.galaxy are external
|
||||||
# and not something maintained here.
|
# and not something maintained here.
|
||||||
|
76
ci/playbooks/publish_collection.yml
Normal file
76
ci/playbooks/publish_collection.yml
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
vars:
|
||||||
|
collection_path: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/tripleo-operator-ansible'].src_dir }}"
|
||||||
|
build_collection_path: /tmp/collection_built/
|
||||||
|
ansible_galaxy_path: "~/.local/bin/ansible-galaxy"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Include role for pip
|
||||||
|
include_role:
|
||||||
|
name: ensure-pip
|
||||||
|
|
||||||
|
- name: Install ansible
|
||||||
|
pip:
|
||||||
|
name: ansible-core<2.12
|
||||||
|
|
||||||
|
- name: Discover tag version
|
||||||
|
set_fact:
|
||||||
|
version_tag: "{{ zuul.tag|default('no_version', true) }}"
|
||||||
|
|
||||||
|
- name: Fail if no tag version found
|
||||||
|
fail:
|
||||||
|
msg: "No tag was found in Zuul vars!"
|
||||||
|
when: version_tag == 'no_version'
|
||||||
|
|
||||||
|
- name: Create a directory for collection
|
||||||
|
file:
|
||||||
|
state: "{{ item }}"
|
||||||
|
path: "{{ build_collection_path }}"
|
||||||
|
mode: 0644
|
||||||
|
loop:
|
||||||
|
- absent
|
||||||
|
- directory
|
||||||
|
|
||||||
|
- name: Set galaxy.yml for right version from tag
|
||||||
|
lineinfile:
|
||||||
|
path: '{{ collection_path }}/galaxy.yml'
|
||||||
|
regexp: '^version:.*'
|
||||||
|
line: 'version: {{ version_tag }}'
|
||||||
|
|
||||||
|
- name: Build collection
|
||||||
|
command: "{{ ansible_galaxy_path }} collection build --output-path {{ build_collection_path }} --force"
|
||||||
|
args:
|
||||||
|
chdir: "{{ collection_path }}"
|
||||||
|
|
||||||
|
- name: Publish content to Ansible Galaxy
|
||||||
|
block:
|
||||||
|
- name: Create ansible.cfg configuration file tempfile
|
||||||
|
tempfile:
|
||||||
|
state: file
|
||||||
|
suffix: .cfg
|
||||||
|
register: _ansiblecfg_tmp
|
||||||
|
|
||||||
|
- name: Create ansible.cfg configuration file
|
||||||
|
copy:
|
||||||
|
dest: "{{ _ansiblecfg_tmp.path }}"
|
||||||
|
mode: 0600
|
||||||
|
content: |
|
||||||
|
[galaxy]
|
||||||
|
server_list = release_galaxy
|
||||||
|
|
||||||
|
[galaxy_server.release_galaxy]
|
||||||
|
url = {{ ansible_galaxy_info.url }}
|
||||||
|
token = {{ ansible_galaxy_info.token }}
|
||||||
|
|
||||||
|
- name: Publish collection to Ansible Galaxy / Automation Hub
|
||||||
|
environment:
|
||||||
|
ANSIBLE_CONFIG: "{{ _ansiblecfg_tmp.path }}"
|
||||||
|
shell: >-
|
||||||
|
{{ ansible_galaxy_path }} collection publish -vvv
|
||||||
|
{{ build_collection_path }}/tripleo-operator-{{ version_tag }}.tar.gz
|
||||||
|
|
||||||
|
always:
|
||||||
|
- name: Shred ansible-galaxy credentials
|
||||||
|
command: "shred {{ _ansiblecfg_tmp.path }}"
|
@ -1,3 +1,27 @@
|
|||||||
|
- job:
|
||||||
|
name: tripleo-operator-ansible-release
|
||||||
|
parent: base
|
||||||
|
run: ci/playbooks/publish_collection.yml
|
||||||
|
secrets:
|
||||||
|
- name: ansible_galaxy_info
|
||||||
|
secret: ansible_galaxy_info_toa
|
||||||
|
|
||||||
|
- secret:
|
||||||
|
name: ansible_galaxy_info_toa
|
||||||
|
data:
|
||||||
|
url: https://galaxy.ansible.com
|
||||||
|
token: !encrypted/pkcs1-oaep
|
||||||
|
- SXQjXSgmtNQeh5e3vElfPvpGfNJcD5Dt9O8ntMUnXspuUWWxPWOtjyhm/o2IEdHvRTEmH
|
||||||
|
EcNpj5MoMv+ufk6PbneC93jJQ6NrA5g5AwP7aZsVyrii1JwtxT37XIZPGPkJ3bvz51UFA
|
||||||
|
CL0U2KdcPz5vf2gzvf/ZvDB0IRZqEVnmlJHG/b84bS+k28aWHdQ4xB2nlsB5mOhuX4gVN
|
||||||
|
2xCgn9rNZwafw9jleuqtMmWYqEICGXWWniLpb8cQAfwXCCpuWnO+2UUremIrocTnbIiQA
|
||||||
|
Smz7UuyMWlOFS8KCgM60/yE+QRorpjT3U63eF+V2cpf2gXY5U7P7RWp2OnzTh2eSoH11x
|
||||||
|
FJ0b2zqDXnmxougo3+1qD/LO11CSBYdH6PxId5VCRbVS3dHLiHJPR7ABqjT8kpiw7Gmh3
|
||||||
|
jAE7Lkk+niAhYr4X+ZcBni1jS3TfAJx5SYMrjLOn5rDbKKk0jTUxfZ6w7aRZxheXTiBOw
|
||||||
|
pgE4j/cwi/VpV45WBCN83I2l63Jz4WGJVPDjhNbYOApxmNDFA8RQeShD5cOyxsnOxh7xU
|
||||||
|
uyb+385Biuc5O1jLSGDBqWbo1O9tdUBAc3ZhpSSUgSP2MY12RIgpj55Qy5TCvy5+4VKH3
|
||||||
|
APbMJDE3uJzdlmRyo6iaFZBziYxYCnvpnH+zYX0VwzdG0WGFUW//OVNE8eN7jM=
|
||||||
|
|
||||||
- project:
|
- project:
|
||||||
templates:
|
templates:
|
||||||
- openstack-python3-ussuri-jobs
|
- openstack-python3-ussuri-jobs
|
||||||
@ -79,3 +103,7 @@
|
|||||||
promote:
|
promote:
|
||||||
jobs:
|
jobs:
|
||||||
- promote-openstack-tox-docs: *tripleo-docs
|
- promote-openstack-tox-docs: *tripleo-docs
|
||||||
|
|
||||||
|
tag:
|
||||||
|
jobs:
|
||||||
|
- tripleo-operator-ansible-release
|
||||||
|
Loading…
x
Reference in New Issue
Block a user