From eb40eef4b55be9a2812478216567f42108655358 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Mon, 3 Aug 2020 17:27:31 +0200 Subject: [PATCH] chore: sync with generics repository Signed-off-by: Christian Berendt --- .github/pr-labeler.yml | 3 ++- .github/workflows/pr-labeler.yml | 3 ++- ....yml => sync-with-generics-repository.yml} | 18 ++++++++----- .github/workflows/syntax-ansible.yml | 19 +++++++++++++ .github/workflows/syntax-yaml.yml | 27 +++++++++++++++++++ .github/yamllint.yml | 5 ++++ gilt.yml | 10 ++++++- molecule/default/create.yml | 20 +++++++------- molecule/default/destroy.yml | 4 +-- molecule/default/prepare.yml | 4 +-- requirements.txt | 2 +- test-requirements.txt | 12 ++++----- 12 files changed, 95 insertions(+), 32 deletions(-) rename .github/workflows/{sync-with-master-repository.yml => sync-with-generics-repository.yml} (59%) create mode 100644 .github/workflows/syntax-ansible.yml create mode 100644 .github/workflows/syntax-yaml.yml create mode 100644 .github/yamllint.yml diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml index f279c72..2fe39cb 100644 --- a/.github/pr-labeler.yml +++ b/.github/pr-labeler.yml @@ -1,9 +1,10 @@ +--- 'Type: Bugfix': ['fix/*', 'issue/*'] 'Type: Build': build/* 'Type: CI': ['ci/*', 'travis/*', 'zuul/*'] 'Type: Documentation': ['docs/*', 'doc/*', 'documentation/*'] 'Type: Feature': ['feature/*', 'feat/*'] -'Type: Maintenance': chore/* +'Type: Maintenance': ['chore/*', 'renovate/*'] 'Type: Refactoring': ['refactor/*', 'refactoring/*'] 'Type: Release': release/* 'Type: Style': style/* diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index 3cda46b..45f1f68 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -1,10 +1,11 @@ +--- name: PR labeler on: pull_request: types: [opened] jobs: - pr-labeler: + default: runs-on: ubuntu-latest steps: - uses: technote-space/pr-labeler-action@v4 diff --git a/.github/workflows/sync-with-master-repository.yml b/.github/workflows/sync-with-generics-repository.yml similarity index 59% rename from .github/workflows/sync-with-master-repository.yml rename to .github/workflows/sync-with-generics-repository.yml index f82154f..a7952bf 100644 --- a/.github/workflows/sync-with-master-repository.yml +++ b/.github/workflows/sync-with-generics-repository.yml @@ -1,13 +1,17 @@ -name: Sync with master repository +--- +name: Sync with generics repository on: - schedule: + push: + paths: + - .github/workflows/sync-with-generics-repository.yml + schedule: - cron: "0 0 * * *" repository_dispatch: - types: [sync-with-master-repository] + types: [sync-with-generics-repository] jobs: - sync-with-master-repository: + default: runs-on: ubuntu-latest steps: - uses: actions/setup-python@v2 @@ -20,9 +24,9 @@ jobs: gilt overlay gilt overlay COMMIT_EMAIL: 'github+actions@osism.de' - COMMIT_MESSAGE: 'chore: sync with master repository' + COMMIT_MESSAGE: 'chore: sync with generics repository' COMMIT_NAME: 'GitHub Actions' ONLY_DEFAULT_BRANCH: true - PR_BRANCH_NAME: 'sync-with-master-repository' + PR_BRANCH_NAME: 'sync-with-generics-repository' PR_BRANCH_PREFIX: 'chore/' - PR_TITLE: 'chore: sync with master repository' + PR_TITLE: 'chore: sync with generics repository' diff --git a/.github/workflows/syntax-ansible.yml b/.github/workflows/syntax-ansible.yml new file mode 100644 index 0000000..5942075 --- /dev/null +++ b/.github/workflows/syntax-ansible.yml @@ -0,0 +1,19 @@ +--- +name: Check ansible syntax + +on: + push: + paths: + - .github/workflows/syntax-ansible.yml + - '**.yml' + pull_request: + paths: + - .github/workflows/syntax-ansible.yml + - '**.yml' + +jobs: + default: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ansible/ansible-lint-action@master diff --git a/.github/workflows/syntax-yaml.yml b/.github/workflows/syntax-yaml.yml new file mode 100644 index 0000000..a95384e --- /dev/null +++ b/.github/workflows/syntax-yaml.yml @@ -0,0 +1,27 @@ +--- +name: Check yaml syntax + +on: + push: + paths: + - .github/workflows/syntax-yaml.yml + - '**.yml' + - '**.yaml' + pull_request: + paths: + - .github/workflows/syntax-yaml.yml + - '**.yml' + - '**.yaml' + +jobs: + default: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + - run: pip3 install yamllint + - run: yamllint --config-file .github/yamllint.yml . diff --git a/.github/yamllint.yml b/.github/yamllint.yml new file mode 100644 index 0000000..75da2b7 --- /dev/null +++ b/.github/yamllint.yml @@ -0,0 +1,5 @@ +--- +extends: default + +rules: + line-length: disable diff --git a/gilt.yml b/gilt.yml index e70bee9..5ef06d2 100644 --- a/gilt.yml +++ b/gilt.yml @@ -1,9 +1,13 @@ --- -- git: https://github.com/osism/travis-master.git +- git: https://github.com/osism/generics.git version: master files: - src: github/*.yml dst: .github/ + - src: github/workflows/*.yml + dst: .github/workflows/ + - src: github/cleanup.sh + dst: scripts/cleanup-github.sh - src: molecule/ansible.cfg dst: molecule/default/ansible.cfg - src: molecule/*.yml @@ -12,6 +16,8 @@ dst: molecule/default/group_vars/ - src: ansible/*requirements.txt dst: ./ + - src: ansible/LICENSE + dst: ./ - src: ansible/gilt.yml dst: ./ - src: ansible/tox.ini @@ -35,3 +41,5 @@ - python3 scripts/render-template.py molecule/default/molecule.yml - python3 scripts/render-template.py tox.ini - rm -f scripts/render-template.py + - bash scripts/cleanup-github.sh + - rm -f scripts/cleanup-github.sh diff --git a/molecule/default/create.yml b/molecule/default/create.yml index fee4bd4..bdb0204 100644 --- a/molecule/default/create.yml +++ b/molecule/default/create.yml @@ -44,7 +44,7 @@ register: keypair - name: Persist the keypair - copy: + copy: # noqa 503 dest: "{{ keypair_path }}" content: "{{ keypair.key.private_key }}" mode: 0600 @@ -62,9 +62,9 @@ key_name: "{{ keypair_name }}" nics: - net-name: "{{ nova.network_name }}" - config_drive: yes - delete_fip: yes - auto_ip: no + config_drive: true + delete_fip: true + auto_ip: false timeout: 360 register: server loop: "{{ molecule_yml.platforms }}" @@ -84,7 +84,7 @@ cloud: molecule server: "{{ item.name }}" network: "{{ nova.floating_ip_pool }}" - wait: yes + wait: true register: floating_ip loop: "{{ molecule_yml.platforms }}" async: 7200 @@ -101,26 +101,24 @@ # Mandatory configuration for molecule to function. - name: Populate instance config dict - set_fact: + set_fact: # noqa 503 instance_conf_dict: { 'instance': "{{ item.0.openstack.name }}", 'address': "{{ item.1.floating_ip.floating_ip_address }}", 'user': "{{ ssh_user }}", 'port': "{{ ssh_port }}", 'identity_file': "{{ keypair_path }}"} - with_together: - - "{{ os_jobs_server.results }}" - - "{{ os_jobs_floating_ip.results }}" + loop: "{{ os_jobs_server.results|zip(os_jobs_floating_ip.results)|list }}" register: instance_config_dict when: server.changed | bool - name: Convert instance config dict to a list - set_fact: + set_fact: # noqa 503 instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}" when: server.changed | bool - name: Dump instance config - copy: + copy: # noqa 503 content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" dest: "{{ molecule_instance_config }}" when: server.changed | bool diff --git a/molecule/default/destroy.yml b/molecule/default/destroy.yml index 3436536..5f062b6 100644 --- a/molecule/default/destroy.yml +++ b/molecule/default/destroy.yml @@ -10,7 +10,7 @@ os_server: cloud: molecule name: "{{ item.name }}" - delete_fip: yes + delete_fip: true state: absent register: server loop: "{{ molecule_yml.platforms }}" @@ -44,7 +44,7 @@ instance_conf: {} - name: Dump instance config - copy: + copy: # noqa 503 # NOTE(retr0h): Workaround for Ansible 2.2. # https://github.com/ansible/ansible/issues/20885 content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 5e15f11..6c8f7ed 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -19,8 +19,8 @@ when: "ansible_distribution_release in ['xenial', 'bionic']" - name: Create loopback device image - command: fallocate -l {{ device_size }} {{ device_file }} creates={{ device_file }} + command: "fallocate -l {{ device_size }} {{ device_file }} creates={{ device_file }}" # noqa 301 - name: Setup loopback device - command: losetup -P /dev/{{ device_name }} {{ device_file }} + command: "losetup -P /dev/{{ device_name }} {{ device_file }}" # noqa 301 become: true diff --git a/requirements.txt b/requirements.txt index 053148f..e4acbca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -tox +tox==3.18.1 diff --git a/test-requirements.txt b/test-requirements.txt index 4842254..6d6a0ed 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,6 @@ -ansible-lint -molecule-openstack -molecule>=3.0 -openstacksdk -paramiko -testinfra +ansible-lint==4.2.0 +molecule-openstack==0.1 +molecule==3.0.6 +openstacksdk==0.48.0 +paramiko==2.7.1 +testinfra==5.2.2