Skip to content

Commit 1b0d8bd

Browse files
authored
Merge branch 'linux-system-roles:main' into main
2 parents 8457160 + 6e0c8bd commit 1b0d8bd

27 files changed

+549
-140
lines changed

.README.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ <h1 class="toc-title">Contents</h1>
142142
</ul></li>
143143
<li><a href="#role-variables" id="toc-role-variables">Role Variables</a>
144144
<ul>
145-
<li><a href="#postgresql_verison"
146-
id="toc-postgresql_verison">postgresql_verison</a></li>
145+
<li><a href="#postgresql_version"
146+
id="toc-postgresql_version">postgresql_version</a></li>
147147
<li><a href="#postgresql_password"
148148
id="toc-postgresql_password">postgresql_password</a></li>
149149
<li><a href="#postgresql_pg_hba_conf"
@@ -193,7 +193,7 @@ <h2 id="collection-requirements">Collection requirements</h2>
193193
<div class="sourceCode" id="cb1"><pre
194194
class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">ansible-galaxy</span> collection install <span class="at">-vv</span> <span class="at">-r</span> meta/collection-requirements.yml</span></code></pre></div>
195195
<h1 id="role-variables">Role Variables</h1>
196-
<h2 id="postgresql_verison">postgresql_verison</h2>
196+
<h2 id="postgresql_version">postgresql_version</h2>
197197
<p>You can set the version of the PostgreSQL server to 10, 12, 13, 15 or
198198
16.</p>
199199
<div class="sourceCode" id="cb2"><pre

.ansible-lint

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ exclude_paths:
2323
mock_roles:
2424
- linux-system-roles.postgresql
2525
- linux-system-roles.certificate
26+
supported_ansible_also:
27+
- "2.14.0"

.fmf/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

.github/workflows/ansible-lint.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install tox, tox-lsr
3333
run: |
3434
set -euxo pipefail
35-
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.2.1"
35+
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.4.0"
3636
3737
- name: Convert role to collection format
3838
run: |
@@ -44,6 +44,6 @@ jobs:
4444
mkdir -p "$coll_dir/.git"
4545
4646
- name: Run ansible-lint
47-
uses: ansible/ansible-lint@v6
47+
uses: ansible/ansible-lint@v24
4848
with:
49-
working_directory: .tox/ansible_collections/${{ env.LSR_ROLE2COLL_NAMESPACE }}/${{ env.LSR_ROLE2COLL_NAME }}
49+
working_directory: ${{ github.workspace }}/.tox/ansible_collections/${{ env.LSR_ROLE2COLL_NAMESPACE }}/${{ env.LSR_ROLE2COLL_NAME }}

.github/workflows/ansible-managed-var-comment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Install tox, tox-lsr
3131
run: |
3232
set -euxo pipefail
33-
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.2.1"
33+
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.4.0"
3434
3535
- name: Run ansible-plugin-scan
3636
run: |

.github/workflows/ansible-plugin-scan.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Install tox, tox-lsr
3131
run: |
3232
set -euxo pipefail
33-
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.2.1"
33+
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.4.0"
3434
3535
- name: Run ansible-plugin-scan
3636
run: |

.github/workflows/ansible-test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install tox, tox-lsr
3434
run: |
3535
set -euxo pipefail
36-
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.2.1"
36+
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.4.0"
3737
3838
- name: Convert role to collection format
3939
run: |
@@ -44,4 +44,4 @@ jobs:
4444
uses: ansible-community/ansible-test-gh-action@release/v1
4545
with:
4646
testing-type: sanity # wokeignore:rule=sanity
47-
collection-src-directory: .tox/ansible_collections/${{ env.LSR_ROLE2COLL_NAMESPACE }}/${{ env.LSR_ROLE2COLL_NAME }}
47+
collection-src-directory: ${{ github.workspace }}/.tox/ansible_collections/${{ env.LSR_ROLE2COLL_NAMESPACE }}/${{ env.LSR_ROLE2COLL_NAME }}

.github/workflows/changelog_to_tag.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
echo "tagname=$_tagname" >> "$GITHUB_OUTPUT"
7070
echo "branch=$_branch" >> "$GITHUB_OUTPUT"
7171
- name: Create tag
72-
uses: mathieudutour/github-tag-action@v6.1
72+
uses: mathieudutour/github-tag-action@v6.2
7373
with:
7474
github_token: ${{ secrets.GITHUB_TOKEN }}
7575
custom_tag: ${{ steps.tag.outputs.tagname }}

.github/workflows/tft.yml

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
---
2+
name: Run integration tests in Testing Farm
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
permissions:
8+
contents: read
9+
# This is required for the ability to create/update the Pull request status
10+
statuses: write
11+
jobs:
12+
prepare_vars:
13+
name: Get info from role and PR to determine if and how to test
14+
# The concurrency key is used to prevent multiple workflows from running at the same time
15+
concurrency:
16+
# group name contains reponame-pr_num to allow simualteneous runs in different PRs
17+
group: testing-farm-${{ github.event.repository.name }}-${{ github.event.issue.number }}
18+
cancel-in-progress: true
19+
# Let's schedule tests only on user request. NOT automatically.
20+
# Only repository owner or member can schedule tests
21+
if: |
22+
github.event.issue.pull_request
23+
&& contains(github.event.comment.body, '[citest]')
24+
&& (contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.comment.author_association)
25+
|| contains('systemroller', github.event.comment.user.login))
26+
runs-on: ubuntu-latest
27+
outputs:
28+
supported_platforms: ${{ steps.supported_platforms.outputs.supported_platforms }}
29+
head_sha: ${{ steps.head_sha.outputs.head_sha }}
30+
memory: ${{ steps.memory.outputs.memory }}
31+
steps:
32+
- name: Dump github context
33+
run: echo "$GITHUB_CONTEXT"
34+
shell: bash
35+
env:
36+
GITHUB_CONTEXT: ${{ toJson(github) }}
37+
38+
- name: Checkout repo
39+
uses: actions/checkout@v4
40+
41+
- name: Get head sha of the PR
42+
id: head_sha
43+
run: |
44+
head_sha=$(gh api "repos/$REPO/pulls/$PR_NO" --jq '.head.sha')
45+
echo "head_sha=$head_sha" >> $GITHUB_OUTPUT
46+
env:
47+
REPO: ${{ github.repository }}
48+
PR_NO: ${{ github.event.issue.number }}
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Checkout PR
52+
uses: actions/checkout@v4
53+
with:
54+
ref: ${{ steps.head_sha.outputs.head_sha }}
55+
56+
- name: Get memory
57+
id: memory
58+
run: |
59+
if [ -d tests/provision.fmf ]; then
60+
memory=$(grep -rPo ' m: \K(.*)' tests/provision.fmf)
61+
fi
62+
if [ -n "$memory" ]; then
63+
echo "memory=$memory" >> $GITHUB_OUTPUT
64+
else
65+
echo "memory=2048" >> $GITHUB_OUTPUT
66+
fi
67+
68+
- name: Get supported platforms
69+
id: supported_platforms
70+
run: |
71+
supported_platforms=""
72+
meta_main=meta/main.yml
73+
# All Fedora are supported, add latest Fedora versions to supported_platforms
74+
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qi fedora$; then
75+
supported_platforms+=" Fedora-39"
76+
supported_platforms+=" Fedora-40"
77+
fi
78+
# Specific Fedora versions supported
79+
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qiP 'fedora\d+$'; then
80+
for fedora_ver in $(yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -iPo 'fedora\K(\d+$)'); do
81+
supported_platforms+=" Fedora-$fedora_ver"
82+
done
83+
fi
84+
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qi el7; then
85+
supported_platforms+=" CentOS-7-latest"
86+
fi
87+
for ver in 8 9 10; do
88+
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qi el"$ver"; then
89+
supported_platforms+=" CentOS-Stream-$ver"
90+
fi
91+
done
92+
echo "supported_platforms=$supported_platforms" >> $GITHUB_OUTPUT
93+
94+
testing-farm:
95+
name: ${{ matrix.platform }}/ansible-${{ matrix.ansible_version }}
96+
needs: prepare_vars
97+
strategy:
98+
fail-fast: false
99+
matrix:
100+
include:
101+
- platform: Fedora-39
102+
ansible_version: 2.17
103+
- platform: Fedora-40
104+
ansible_version: 2.17
105+
- platform: CentOS-7-latest
106+
ansible_version: 2.9
107+
- platform: CentOS-Stream-8
108+
ansible_version: 2.9
109+
# On CentOS-Stream-8, latest supported Ansible is 2.16
110+
- platform: CentOS-Stream-8
111+
ansible_version: 2.16
112+
- platform: CentOS-Stream-9
113+
ansible_version: 2.17
114+
- platform: CentOS-Stream-10
115+
ansible_version: 2.17
116+
runs-on: ubuntu-latest
117+
env:
118+
ARTIFACTS_DIR_NAME: "tf_${{ github.event.repository.name }}-${{ github.event.issue.number }}_\
119+
${{ matrix.platform }}-${{ matrix.ansible_version }}_\
120+
${{ needs.prepare_vars.outputs.datetime }}/artifacts"
121+
ARTIFACT_TARGET_DIR: /srv/pub/alt/${{ vars.LINUXSYSTEMROLES_USER }}/logs
122+
steps:
123+
- name: Set variables with DATETIME and artifact location
124+
id: set_vars
125+
run: |
126+
printf -v DATETIME '%(%Y%m%d-%H%M%S)T' -1
127+
ARTIFACTS_DIR_NAME="tf_${{ github.event.repository.name }}-${{ github.event.issue.number }}_\
128+
${{ matrix.platform }}-${{ matrix.ansible_version }}_$DATETIME/artifacts"
129+
ARTIFACTS_TARGET_DIR=/srv/pub/alt/${{ vars.LINUXSYSTEMROLES_USER }}/logs
130+
ARTIFACTS_DIR=$ARTIFACTS_TARGET_DIR/$ARTIFACTS_DIR_NAME
131+
ARTIFACTS_URL=https://dl.fedoraproject.org/pub/alt/${{ vars.LINUXSYSTEMROLES_USER }}/logs/$ARTIFACTS_DIR_NAME
132+
echo "DATETIME=$DATETIME" >> $GITHUB_OUTPUT
133+
echo "ARTIFACTS_DIR=$ARTIFACTS_DIR" >> $GITHUB_OUTPUT
134+
echo "ARTIFACTS_URL=$ARTIFACTS_URL" >> $GITHUB_OUTPUT
135+
136+
- name: Set commit status as pending
137+
if: contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
138+
uses: myrotvorets/set-commit-status-action@master
139+
with:
140+
sha: ${{ needs.prepare_vars.outputs.head_sha }}
141+
status: pending
142+
context: ${{ matrix.platform }}|ansible-${{ matrix.ansible_version }}
143+
description: Test started
144+
targetUrl: ""
145+
146+
- name: Set commit status as success with a description that platform is skipped
147+
if: "!contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)"
148+
uses: myrotvorets/set-commit-status-action@master
149+
with:
150+
sha: ${{ needs.prepare_vars.outputs.head_sha }}
151+
status: success
152+
context: ${{ matrix.platform }}|ansible-${{ matrix.ansible_version }}
153+
description: The role does not support this platform. Skipping.
154+
targetUrl: ""
155+
156+
- name: Run test in testing farm
157+
uses: sclorg/testing-farm-as-github-action@v3
158+
if: contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
159+
with:
160+
git_url: https://github.com/linux-system-roles/tft-tests
161+
git_ref: main
162+
pipeline_settings: '{ "type": "tmt-multihost" }'
163+
environment_settings: '{ "provisioning": { "tags": { "BusinessUnit": "system_roles" } } }'
164+
# Keeping ARTIFACTS_URL at the bottom makes the link in logs clickable
165+
variables: "ANSIBLE_VER=${{ matrix.ansible_version }};\
166+
REPO_NAME=${{ github.event.repository.name }};\
167+
GITHUB_ORG=${{ github.repository_owner }};\
168+
PR_NUM=${{ github.event.issue.number }};\
169+
ARTIFACTS_DIR=${{ steps.set_vars.outputs.ARTIFACTS_DIR }};\
170+
TEST_LOCAL_CHANGES=false;\
171+
LINUXSYSTEMROLES_USER=${{ vars.LINUXSYSTEMROLES_USER }};\
172+
ARTIFACTS_URL=${{ steps.set_vars.outputs.ARTIFACTS_URL }}"
173+
# Note that LINUXSYSTEMROLES_SSH_KEY must be single-line, TF doesn't read multi-line variables fine.
174+
secrets: "LINUXSYSTEMROLES_DOMAIN=${{ secrets.LINUXSYSTEMROLES_DOMAIN }};\
175+
LINUXSYSTEMROLES_SSH_KEY=${{ secrets.LINUXSYSTEMROLES_SSH_KEY }}"
176+
compose: ${{ matrix.platform }}
177+
# There are two blockers for using public ranch:
178+
# 1. multihost is not supported in public https://github.com/teemtee/tmt/issues/2620
179+
# 2. Security issue that leaks long secrets - Jira TFT-2698
180+
tf_scope: private
181+
api_key: ${{ secrets.TF_API_KEY_RH }}
182+
update_pull_request_status: false
183+
tmt_hardware: '{ "memory": ">= ${{ needs.prepare_vars.outputs.memory }} MB" }'
184+
tmt_plan_filter: "tag:general,postgresql"
185+
186+
- name: Set final commit status
187+
uses: myrotvorets/set-commit-status-action@master
188+
if: always() && contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
189+
with:
190+
sha: ${{ needs.prepare_vars.outputs.head_sha }}
191+
status: ${{ job.status }}
192+
context: ${{ matrix.platform }}|ansible-${{ matrix.ansible_version }}
193+
description: Test finished
194+
targetUrl: ${{ steps.set_vars.outputs.ARTIFACTS_URL }}

.github/workflows/tft_citest_bad.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Re-run failed testing farm tests
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
permissions:
8+
contents: read
9+
jobs:
10+
citest_bad_rerun:
11+
if: |
12+
github.event.issue.pull_request
13+
&& contains(fromJson('["[citest_bad]", "[citest-bad]", "[citest bad]"]'), github.event.comment.body)
14+
&& contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.comment.author_association)
15+
permissions:
16+
actions: write # for re-running failed jobs: https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#re-run-a-job-from-a-workflow-run
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Wait 10s until tft.yml workflow is created and skipped because new comment don't match [citest]
20+
run: sleep 10s
21+
22+
- name: Re-run failed jobs for this PR
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
REPO: ${{ github.repository }}
26+
PR_TITLE: ${{ github.event.issue.title }}
27+
run: |
28+
PENDING_RUN=$(gh api "repos/$REPO/actions/workflows/tft.yml/runs?event=issue_comment" \
29+
| jq -r "[.workflow_runs[] | select( .display_title == \"$PR_TITLE\") | \
30+
select(.status == \"pending\" or .status == \"queued\" or .status == \"in_progress\") | .id][0]")
31+
# if pending run don't exist, take the last run with failure state
32+
if [ "$PENDING_RUN" != "null" ]; then
33+
echo "The workflow $PENDING_RUN is still running, wait for it to finish to re-run"
34+
exit 1
35+
fi
36+
RUN_ID=$(gh api "repos/$REPO/actions/workflows/tft.yml/runs?event=issue_comment" \
37+
| jq -r "[.workflow_runs[] | select( .display_title == \"$PR_TITLE\" ) | select( .conclusion == \"failure\" ) | .id][0]")
38+
if [ "$RUN_ID" = "null" ]; then
39+
echo "Failed workflow not found, exitting"
40+
exit 1
41+
fi
42+
echo "Re-running workflow $RUN_ID"
43+
gh api --method POST repos/$REPO/actions/runs/$RUN_ID/rerun-failed-jobs
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
postgresql-server
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
postgresql-server

.yamllint.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# SPDX-License-Identifier: MIT
22
---
3-
extends: default
43
ignore: |
54
/.tox/

0 commit comments

Comments
 (0)