Skip to content

chore: Bump ansible version to 2.22 in meta #209

chore: Bump ansible version to 2.22 in meta

chore: Bump ansible version to 2.22 in meta #209

Workflow file for this run

---
name: Ansible CI
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- labeled
schedule:
- cron: "5 4 * * 1"
workflow_dispatch:
concurrency:
group: ansible-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
ANSIBLE_FORCE_COLOR: true
ANSIBLE_GALAXY_SERVER_GALAXY_URL: "https://galaxy.ansible.com"
ANSIBLE_GALAXY_SERVER_GALAXY_TIMEOUT: 120
ANSIBLE_GALAXY_SERVER_LIST: "galaxy"
jobs:
ansible-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Lint collection
uses: ansible/ansible-lint@9bce2bfb8f4a984e6b13767bc0d6bf0a49492164 # v26.10.1
arguments-spec-lint:
runs-on: ubuntu-latest
container:
image: quay.io/prometheus/golang-builder:base
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Lint arguments spec
run: ./.github/scripts/lint_arguments_spec.sh
check-unused-variables:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Run action
uses: hoo29/little-timmy@c8ca5086db961499fc3d4e37637f566c3d0ec6d6 # v3-action
discover-ansible-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.supported-ansible-versions.outputs.result }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Get Ansible versions that the collection supports
id: supported-ansible-versions
run: |
echo "result=$(python ./.github/scripts/collection_version_parser.py)" | tee -a "$GITHUB_OUTPUT"
ansible-test-sanity:
uses: ./.github/workflows/ansible-test-sanity.yml
needs:
- discover-ansible-versions
with:
ansible-core-versions: ${{ needs.discover-ansible-versions.outputs.versions }}
discover-ansible-tests:
runs-on: ubuntu-latest
needs:
- ansible-lint
outputs:
integration-tests: ${{ steps.set-integration-tests.outputs.tests }}
ansible-roles: ${{ steps.set-ansible-roles.outputs.roles }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Fetch current PR labels
id: fetch-labels
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const { owner, repo } = context.repo;
const eventName = context.eventName;
let labels = new Array();
// For schedule/manual jobs, add all roles to tests by fetching all possible labels
if (eventName === "schedule" || eventName === "workflow_dispatch") {
const allLabels = await github.paginate(
github.rest.issues.listLabelsForRepo,
{ owner, repo }
);
for (const label of allLabels) {
if (label.name.startsWith("roles/")) {
labels.push(label);
}
}
} else {
const issue_number = context.issue.number;
labels = await github.paginate(
github.rest.issues.listLabelsOnIssue,
{ owner, repo, issue_number }
);
}
const names = labels.map(l => l.name);
core.info(`Current labels: ${names.join(', ') || '(none)'}`);
core.setOutput('names', JSON.stringify(names));
- name: Discover ansible roles
id: set-ansible-roles
env:
LABELS: ${{ steps.fetch-labels.outputs.names }}
run: |
roles=$(echo $LABELS | jq -c '[.[] | select(startswith("roles/")) | ltrimstr("roles/")]')
echo $roles
echo "roles=$roles" | tee -a "$GITHUB_OUTPUT"
- name: Discover integration tests
id: set-integration-tests
run: |
echo tests="[`for test in $(find tests/integration/targets -maxdepth 1 -mindepth 1 -type d -not -iname "molecule-*" -printf "%f\n"); do
echo '{"test":\"'"${test}"'\","name":\"'"${test}\"'"}';
done | tr '\n' ',' | sed '$s/,$//'`]" | tee -a "$GITHUB_OUTPUT"
molecule:
uses: ./.github/workflows/ansible-test-molecule.yml
needs:
- discover-ansible-tests
- discover-ansible-versions
if: needs.discover-ansible-tests.outputs.ansible-roles != '[]' &&
needs.discover-ansible-tests.outputs.ansible-roles != ''
with:
role: ${{ matrix.role }}
ansible-core-versions: ${{ needs.discover-ansible-versions.outputs.versions }}
strategy:
fail-fast: false
matrix:
role: ${{ fromJson(needs.discover-ansible-tests.outputs.ansible-roles) }}
ansible-test-integration:
uses: ./.github/workflows/ansible-test-integration.yml
needs:
- discover-ansible-tests
- discover-ansible-versions
if:
needs.discover-ansible-tests.outputs.integration-tests != '[]' &&
needs.discover-ansible-tests.outputs.integration-tests != ''
with:
targets: ${{ needs.discover-ansible-tests.outputs.integration-tests }}
ansible-core-versions: ${{ needs.discover-ansible-versions.outputs.versions }}
discord-notification:
runs-on: ubuntu-latest
needs:
- molecule
if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
steps:
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
if [ "${{ needs.molecule.result }}" == "success" ]; then
COLOR=5763719
STATUS="Success"
EMOJI=":white_check_mark:"
else
COLOR=15548997
STATUS="Failed"
EMOJI=":x:"
fi
curl -H "Content-Type: application/json" \
-d "{
\"embeds\": [{
\"title\": \"$EMOJI Ansible Molecule Testing - $STATUS\",
\"description\": \"Molecule testing of Ansible roles in \`${{ github.repository }}\`\",
\"color\": $COLOR,
\"fields\": [
{\"name\": \"Branch\", \"value\": \"\`${{ github.ref_name }}\`\", \"inline\": true},
{\"name\": \"Commit\", \"value\": \"\`${{ github.sha }}\`\", \"inline\": true},
{\"name\": \"Author\", \"value\": \"${{ github.actor }}\", \"inline\": true}
],
\"url\": \"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"
}]
}" \
$DISCORD_WEBHOOK