1+ ---
12name : Run integration tests in Testing Farm
23on :
34 issue_comment :
@@ -7,26 +8,32 @@ permissions:
78 contents : read
89 # This is required for the ability to create/update the Pull request status
910 statuses : write
10- # The concurrency key is used to prevent multiple workflows from running at the same time
11- concurrency :
12- # group name contains reponame-pr_num to allow simualteneous runs in different PRs
13- group : testing-farm-${{ github.event.repository.name }}-${{ github.event.issue.number }}
14- cancel-in-progress : true
1511jobs :
1612 prepare_vars :
1713 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
1819 # Let's schedule tests only on user request. NOT automatically.
1920 # Only repository owner or member can schedule tests
2021 if : |
2122 github.event.issue.pull_request
22- && (contains(github.event.comment.body, '[citest]') || contains(github.event.comment.body, '[citest-all]'))
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))
2326 runs-on : ubuntu-latest
2427 outputs :
2528 supported_platforms : ${{ steps.supported_platforms.outputs.supported_platforms }}
2629 head_sha : ${{ steps.head_sha.outputs.head_sha }}
27- datetime : ${{ steps.datetime.outputs.datetime }}
2830 memory : ${{ steps.memory.outputs.memory }}
2931 steps :
32+ - name : Dump github context
33+ run : echo "$GITHUB_CONTEXT"
34+ shell : bash
35+ env :
36+ GITHUB_CONTEXT : ${{ toJson(github) }}
3037
3138 - name : Checkout repo
3239 uses : actions/checkout@v4
4148 PR_NO : ${{ github.event.issue.number }}
4249 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4350
44- - name : Get cuurent datetime
45- id : datetime
46- run : |
47- printf -v datetime '%(%Y%m%d-%H%M%S)T' -1
48- echo "datetime=$datetime" >> $GITHUB_OUTPUT
49-
5051 - name : Get memory
5152 id : memory
5253 run : |
@@ -114,6 +115,19 @@ jobs:
114115 ${{ needs.prepare_vars.outputs.datetime }}/artifacts"
115116 ARTIFACT_TARGET_DIR : /srv/pub/alt/linuxsystemroles/logs
116117 steps :
118+ - name : Set variables with DATETIME and artifact location
119+ id : set_vars
120+ run : |
121+ printf -v DATETIME '%(%Y%m%d-%H%M%S)T' -1
122+ ARTIFACTS_DIR_NAME="tf_${{ github.event.repository.name }}-${{ github.event.issue.number }}_\
123+ ${{ matrix.platform }}-${{ matrix.ansible_version }}_$DATETIME/artifacts"
124+ ARTIFACTS_TARGET_DIR=/srv/pub/alt/linuxsystemroles/logs
125+ ARTIFACTS_DIR=$ARTIFACTS_TARGET_DIR/$ARTIFACTS_DIR_NAME
126+ ARTIFACTS_URL=https://dl.fedoraproject.org/pub/alt/linuxsystemroles/logs$ARTIFACTS_DIR_NAME
127+ echo "DATETIME=$DATETIME" >> $GITHUB_OUTPUT
128+ echo "ARTIFACTS_DIR=$ARTIFACTS_DIR" >> $GITHUB_OUTPUT
129+ echo "ARTIFACTS_URL=$ARTIFACTS_URL" >> $GITHUB_OUTPUT
130+
117131 - name : Set commit status as pending
118132 if : contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
119133 uses : myrotvorets/set-commit-status-action@master
@@ -137,19 +151,17 @@ jobs:
137151 - name : Run test in testing farm
138152 uses : sclorg/testing-farm-as-github-action@v3
139153 if : contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
140- env :
141- ARTIFACTS_DIR : ${{ env.ARTIFACT_TARGET_DIR }}/${{ env.ARTIFACTS_DIR_NAME }}
142- ARTIFACTS_URL : https://dl.fedoraproject.org/pub/alt/linuxsystemroles/logs/${{ env.ARTIFACTS_DIR_NAME }}
143154 with :
144- git_url : ${{ github.server_url }}/${{ github.repository }}
145- git_ref : ${{ needs.prepare_vars.outputs.head_sha }}
155+ git_url : https:// github.com/linux-system-roles/tft-tests
156+ git_ref : main
146157 pipeline_settings : ' { "type": "tmt-multihost" }'
147158 variables : " ANSIBLE_VER=${{ matrix.ansible_version }};\
148159 REPO_NAME=${{ github.event.repository.name }};\
160+ GITHUB_ORG=${{ github.repository_owner }};\
149161 GITHUB_ORG=linux-system-roles;\
150162 PR_NUM=${{ github.event.issue.number }};\
151- ARTIFACTS_DIR=${{ env .ARTIFACTS_DIR }};\
152- ARTIFACTS_URL=${{ env .ARTIFACTS_URL }};\
163+ ARTIFACTS_DIR=${{ steps.set_vars.outputs .ARTIFACTS_DIR }};\
164+ ARTIFACTS_URL=${{ steps.set_vars.outputs .ARTIFACTS_URL }};\
153165 TEST_LOCAL_CHANGES=false"
154166 # Note that LINUXSYSTEMROLES_SSH_KEY must be single-line, TF doesn't read multi-line variables fine.
155167 secrets : " LINUXSYSTEMROLES_USER=${{ secrets.LINUXSYSTEMROLES_USER }};\
@@ -167,11 +179,9 @@ jobs:
167179 - name : Set final commit status
168180 uses : myrotvorets/set-commit-status-action@master
169181 if : always() && contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
170- env :
171- ARTIFACTS_URL : https://dl.fedoraproject.org/pub/alt/linuxsystemroles/logs/${{ env.ARTIFACTS_DIR_NAME }}
172182 with :
173183 sha : ${{ needs.prepare_vars.outputs.head_sha }}
174184 status : ${{ job.status }}
175185 context : ${{ matrix.platform }}|ansible-${{ matrix.ansible_version }}
176186 description : Test finished
177- targetUrl : ${{ env .ARTIFACTS_URL }}
187+ targetUrl : ${{ steps.set_vars.outputs .ARTIFACTS_URL }}
0 commit comments