Skip to content

Commit 1227eae

Browse files
fix: fix composite actions paths
1 parent c954809 commit 1227eae

File tree

7 files changed

+431
-160
lines changed

7 files changed

+431
-160
lines changed
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Get called workflow ref
2+
3+
description: >
4+
A workaround to the issue: https://github.com/actions/toolkit/issues/1264.
5+
6+
This is needed for the reusable workflow to be able to access its own version (commit hash)
7+
that is being called by the caller workflow. This allows for using a proper ref of composite actions
8+
inside the reusable workflow.
9+
10+
inputs:
11+
GH_TOKEN_ADMIN:
12+
required: true
13+
14+
outputs:
15+
caller-ref:
16+
value: ${{ steps.workflows-ref.outputs.caller-ref }}
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Get workflow reference
22+
id: workflows-ref
23+
shell: bash
24+
run: |
25+
ref=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ inputs.GH_TOKEN_ADMIN }}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/splunk/splunk-add-on-for-microsoft-cloud-services/actions/runs/${{ github.run_id }} | jq -r '.referenced_workflows[0] | .ref')
26+
echo "caller-ref=$ref" >> $GITHUB_OUTPUT

.github/actions/appinspect-api/action.yml

-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ inputs:
1616
runs:
1717
using: composite
1818
steps:
19-
- name: Checkout repository
20-
uses: actions/checkout@v3
21-
2219
- name: Download artifact
2320
uses: actions/download-artifact@v3
2421
with:

.github/actions/build/action.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ runs:
4343
- name: Setup python
4444
uses: actions/setup-python@v4
4545
with:
46-
python-version: 3.7
46+
python-version: ${{ inputs.python_version }}
4747

4848
- name: Create requirements file for pip
4949
shell: bash
@@ -94,7 +94,8 @@ runs:
9494

9595
- name: Semantic Release Get Next
9696
id: semantic
97-
if: github.event_name != 'pull_request'
97+
# this condition doesn't make sense as BuildVersion needs output from this step anyway
98+
# if: github.event_name != 'pull_request'
9899
uses: splunk/[email protected]
99100
with:
100101
dry_run: true
@@ -131,6 +132,9 @@ runs:
131132
run: |
132133
cp -f THIRDPARTY package/THIRDPARTY || echo "THIRDPARTY file not found (allowed for PR and schedule)"
133134
135+
- name: Checkout repository
136+
uses: actions/checkout@v3
137+
134138
- name: Build Package
135139
id: uccgen
136140
uses: splunk/addonfactory-ucc-generator-action@v2
@@ -144,6 +148,13 @@ runs:
144148
with:
145149
source: ${{ steps.uccgen.outputs.OUTPUT }}
146150

151+
- name: debug
152+
shell: bash
153+
run: |
154+
echo "${{ inputs.python_version }}"
155+
echo "${{ inputs.ucc_modinput_functional }}"
156+
echo "${{ github.event_name }}"
157+
147158
- name: Artifact OpenAPI
148159
if: ${{ inputs.python_version }} == '3.7' && ${{ !cancelled() && inputs.ucc_modinput_functional == 'true' && inputs.modinput_functional == 'true' }}
149160
uses: actions/upload-artifact@v3

.github/actions/compliance-copyrights/action.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@ description: >
77
runs:
88
using: composite
99
steps:
10-
- name: Checkout repository
11-
uses: actions/checkout@v3
10+
# - name: Repo checkout
11+
# uses: actions/checkout@v3
1212

1313
- name: REUSE Compliance Check
14-
uses: fsfe/[email protected]
14+
uses: fsfe/[email protected]
15+
16+
- name: Debug
17+
shell: bash
18+
run: echo 'DEBUG lampss'
19+
20+
# - name: Repo checkout
21+
# uses: actions/checkout@v3
22+
# with:
23+
# repository: splunk/addonfactory-workflow-addon-release
24+
# ref: fix/lightweight-workflow-ADDON-66448

.github/actions/meta/action.yml

+26-6
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ inputs:
1616
required: true
1717

1818
outputs:
19-
sc4s:
19+
sc4s:
2020
# using fromJSON as below gave an error `error reading JToken from JsonReader` - hence using jq
2121
# value: ghcr.io/${{ github.repository }}/container:${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.version'] }}
2222
# https://github.com/splunk/splunk-add-on-for-microsoft-cloud-services/actions/runs/7019443167/job/19104471863#step:7:4
23-
value: ghcr.io/${{ github.repository }}/container:$(echo "${{ steps.docker_action_meta.outputs.json }}" | jq -r '.labels["org.opencontainers.image.version"]')
23+
value: ghcr.io/${{ github.repository }}/container:$(echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.version"]')
2424
container_tags:
2525
value: ${{ steps.docker_action_meta.outputs.tags }}
2626
container_labels:
2727
value: ${{ steps.docker_action_meta.outputs.labels }}
2828
container_buildtime:
29-
value: $(echo "${{ steps.docker_action_meta.outputs.json }}" | jq -r '.labels["org.opencontainers.image.created"]')
29+
value: $(echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.created"]')
3030
container_version:
31-
value: $(echo "${{ steps.docker_action_meta.outputs.json }}" | jq -r '.labels["org.opencontainers.image.version"]')
31+
value: $(echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.version"]')
3232
container_revision:
33-
value: $(echo "${{ steps.docker_action_meta.outputs.json }}" | jq -r '.labels["org.opencontainers.image.revision"]')
33+
value: $(echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.revision"]')
3434
container_base:
35-
value: $(echo "${{ steps.docker_action_meta.outputs.json }}" | jq -r '.tags[0]')
35+
value: $(echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.tags[0]')
3636
matrix_supportedSplunk:
3737
value: ${{ steps.matrix.outputs.supportedSplunk }}
3838
matrix_latestSplunk:
@@ -54,6 +54,7 @@ runs:
5454
- name: Checkout repository
5555
uses: actions/checkout@v3
5656
with:
57+
repository: ${{ github.repository }}
5758
submodules: false
5859
persist-credentials: false
5960

@@ -83,6 +84,18 @@ runs:
8384
type=ref,event=branch
8485
type=ref,event=pr
8586
87+
# - name: Set Docker meta outputs
88+
# id: docker_meta_outputs
89+
# shell: bash
90+
# # echo 'sc4s_version=${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.version"]' >> "$GITHUB_OUTPUT"
91+
# run: |
92+
# outputs_json=${{ steps.docker_action_meta.outputs.json }}
93+
# echo 'sc4s_version=$outputs_json' | jq -r '.labels["org.opencontainers.image.version"]' >> "$GITHUB_OUTPUT"
94+
# echo 'container_buildtime=${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.created"]' >> "$GITHUB_OUTPUT"
95+
# echo 'container_version=${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.version"]' >> "$GITHUB_OUTPUT"
96+
# echo 'container_revision=${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.revision"]' >> "$GITHUB_OUTPUT"
97+
# echo 'container_base=${{ steps.docker_action_meta.outputs.json }}' | jq -r '.tags[0]' >> "$GITHUB_OUTPUT"
98+
8699
- name: matrix
87100
id: matrix
88101
uses: splunk/[email protected]
@@ -93,3 +106,10 @@ runs:
93106
run: |
94107
echo "splunk={\"version\":\"unreleased-python3_9-a076ce4c50aa\", \"build\":\"a076ce4c50aa\", \"islatest\":false, \"isoldest\":false}" >> "$GITHUB_OUTPUT"
95108
echo "sc4s={\"version\":\"2.49.5\", \"docker_registry\":\"ghcr.io/splunk/splunk-connect-for-syslog/container2\"}" >> "$GITHUB_OUTPUT"
109+
110+
- name: Checkout repository
111+
uses: actions/checkout@v3
112+
113+
- name: Debug outputs
114+
shell: bash
115+
run: echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.version"]'

0 commit comments

Comments
 (0)