Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Ansible-lint: Add example config for github action #612

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
MarkusTeufelberger marked this conversation as resolved.
Show resolved Hide resolved
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

skip_list:
# Docs: https://ansible.readthedocs.io/projects/lint/rules/ignore-errors/
# Disabled for this collection because we mostly lint test code that has deliberate errors in places and isn't intended to be directly used outside of tests.
- ignore-errors
# Docs: https://ansible.readthedocs.io/projects/lint/rules/sanity/
# Disabled for this collection because our ignores are deliberate. There is also no way of applying this check in a more granular way.
- sanity[cannot-ignore]
538 changes: 538 additions & 0 deletions .ansible-lint-ignore

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

name: ansible-lint
"on":
pull_request:
branches: ["main", "stable-*"]
jobs:
build:
name: Ansible Lint
runs-on: ubuntu-latest
steps:
- name: Run ansible-lint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A checkout step needs to be added before here. There was a breaking change in the action that started requiring that.

uses: ansible/ansible-lint@main
2 changes: 1 addition & 1 deletion .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# https://github.com/marketplace/actions/ansible-test

name: EOL CI
on:
"on":
# Run EOL CI against all pushes (direct commits, also merged PRs), Pull Requests
push:
branches:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Collection Docs
concurrency:
group: docs-pr-${{ github.head_ref }}
cancel-in-progress: true
on:
"on":
pull_request_target:
types: [opened, synchronize, reopened, closed]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Collection Docs
concurrency:
group: docs-push-${{ github.sha }}
cancel-in-progress: true
on:
"on":
push:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later

name: execution environment
on:
"on":
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
push:
branches:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

name: Verify REUSE

on:
"on":
push:
branches: [main]
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ license:
- BSD-2-Clause
- BSD-3-Clause
- PSF-2.0
#license_file: COPYING
# license_file: COPYING
tags:
- acme
- certificate
Expand Down
3 changes: 2 additions & 1 deletion tests/ee/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

- hosts: localhost
- name: Run all tests
hosts: localhost
tasks:
- name: Show Python info
debug:
Expand Down
4 changes: 2 additions & 2 deletions tests/ee/roles/smoke/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
smoke_ipaddress:
register: result

- name: Validate result
- name: Validate result
assert:
that:
- result.msg == 'Everything is ok'
Expand All @@ -16,7 +16,7 @@
smoke_pyyaml:
register: result

- name: Validate result
- name: Validate result
assert:
that:
- result.msg == 'Everything is ok'
16 changes: 8 additions & 8 deletions tests/integration/targets/acme_certificate/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,24 @@
- subject_key_identifier
- issuer
- subject
#- serial_number
#- public_key_fingerprints
# - serial_number
# - public_key_fingerprints

- name: ACME root certificate info
debug:
var: acme_roots

#- name: ACME root certificates as PEM
# debug:
# var: acme_root_certs
# - name: ACME root certificates as PEM
# debug:
# var: acme_root_certs

- name: ACME intermediate certificate info
debug:
var: acme_intermediates

#- name: ACME intermediate certificates as PEM
# debug:
# var: acme_intermediate_certs
# - name: ACME intermediate certificates as PEM
# debug:
# var: acme_intermediate_certs

- block:
- name: Running tests with OpenSSL backend
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/targets/acme_inspect/tasks/impl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@
account_uri: "{{ account_creation.headers.location }}"
url: "{{ new_order.headers.location }}"
method: get
register: order
- debug: var=order
register: cert_order
- debug: var=cert_order

- name: Get authzs for order
- name: Get authzs for cert_order
acme_inspect:
acme_directory: https://{{ acme_host }}:14000/dir
acme_version: 2
Expand All @@ -120,7 +120,7 @@
account_uri: "{{ account_creation.headers.location }}"
url: "{{ item }}"
method: get
loop: "{{ order.output_json.authorizations }}"
loop: "{{ cert_order.output_json.authorizations }}"
register: authz
- debug: var=authz

Expand Down
14 changes: 7 additions & 7 deletions tests/integration/targets/acme_inspect/tests/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@
- new_order.output_json.status == 'pending'
- "'finalize' in new_order.output_json"

- name: Check get order output
- name: Check get cert_order output
assert:
that:
- order is not changed
- "'directory' in order"
- "'headers' in order"
- "'output_text' in order"
- "'output_json' in order"
- cert_order is not changed
- "'directory' in cert_order"
- "'headers' in cert_order"
- "'output_text' in cert_order"
- "'output_json' in cert_order"
# The order of identifiers and authorizations is randomized!
# - new_order.output_json == order.output_json
# - new_order.output_json == cert_order.output_json

- name: Check get authz output
assert:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
- result is failed
# We got the expected error message
- "'The handshake operation timed out' in result.msg or 'unknown protocol' in result.msg or 'wrong version number' in result.msg"

- name: Test timeout option
get_certificate:
host: "{{ httpbin_host }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,4 @@
- name: Remove certificate
openssh_cert:
path: "{{ certificate_path }}"
state: absent
state: absent
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
mode: '0700'
with_nested:
- "{{ regenerate_values }}"
- [ '', '.pub' ]
- ['', '.pub']

- name: "({{ backend }}) Regenerate - setup password protected keys for passphrse test"
command: 'ssh-keygen -f {{ remote_tmp_dir }}/regenerate-d-{{ item }} -N {{ passphrase }}'
Expand Down Expand Up @@ -261,7 +261,7 @@
remote_src: true
with_nested:
- "{{ regenerate_values }}"
- [ '', '.pub' ]
- ['', '.pub']
when: "item.0 != 'always'"

- name: "({{ backend }}) Regenerate - adjust key type (check mode)"
Expand Down Expand Up @@ -310,7 +310,7 @@
remote_src: true
with_nested:
- "{{ regenerate_values }}"
- [ '', '.pub' ]
- ['', '.pub']
when: "item.0 != 'always'"

- name: "({{ backend }}) Regenerate - adjust comment (check mode)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@
when: 'select_crypto_backend == "cryptography" and cryptography_version.stdout is version("2.6", ">=")'



# Test regenerate option

- name: "({{ select_crypto_backend }}) Regenerate - setup simple keys"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
that:
- publickey5_pubkey.stdout == privatekey5_pubkey.stdout

- name:
- name: "({{ select_crypto_backend }}) Validate failed passphrases"
assert:
that:
- passphrase_error_1 is failed
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/setup_ssh_agent/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

- name: Assert agent socket file is a socket
assert:
that:
that:
- openssh_agent_socket_stat.stat.issock is defined
- openssh_agent_socket_stat.stat.issock
fail_msg: "{{ openssh_agent_sock }} is not a socket"
Expand Down