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

fix: fix composite actions paths #203

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 26 additions & 0 deletions .github/actions/_called-wf-ref/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Get called workflow ref

description: >
A workaround to the issue: https://github.com/actions/toolkit/issues/1264.

This is needed for the reusable workflow to be able to access its own version (commit hash)
that is being called by the caller workflow. This allows for using a proper ref of composite actions
inside the reusable workflow.

inputs:
GH_TOKEN_ADMIN:
required: true

outputs:
caller-ref:
value: ${{ steps.workflows-ref.outputs.caller-ref }}

runs:
using: composite
steps:
- name: Get workflow reference
id: workflows-ref
shell: bash
run: |
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')
echo "caller-ref=$ref" >> $GITHUB_OUTPUT
3 changes: 0 additions & 3 deletions .github/actions/appinspect-api/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ inputs:
runs:
using: composite
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Download artifact
uses: actions/download-artifact@v3
with:
Expand Down
15 changes: 13 additions & 2 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ runs:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: ${{ inputs.python_version }}

- name: Create requirements file for pip
shell: bash
Expand Down Expand Up @@ -94,7 +94,8 @@ runs:

- name: Semantic Release Get Next
id: semantic
if: github.event_name != 'pull_request'
# this condition doesn't make sense as BuildVersion needs output from this step anyway
# if: github.event_name != 'pull_request'
uses: splunk/[email protected]
with:
dry_run: true
Expand Down Expand Up @@ -131,6 +132,9 @@ runs:
run: |
cp -f THIRDPARTY package/THIRDPARTY || echo "THIRDPARTY file not found (allowed for PR and schedule)"

- name: Checkout repository
uses: actions/checkout@v3

- name: Build Package
id: uccgen
uses: splunk/addonfactory-ucc-generator-action@v2
Expand All @@ -144,6 +148,13 @@ runs:
with:
source: ${{ steps.uccgen.outputs.OUTPUT }}

- name: debug
shell: bash
run: |
echo "${{ inputs.python_version }}"
echo "${{ inputs.ucc_modinput_functional }}"
echo "${{ github.event_name }}"

- name: Artifact OpenAPI
if: ${{ inputs.python_version }} == '3.7' && ${{ !cancelled() && inputs.ucc_modinput_functional == 'true' && inputs.modinput_functional == 'true' }}
uses: actions/upload-artifact@v3
Expand Down
16 changes: 13 additions & 3 deletions .github/actions/compliance-copyrights/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@ description: >
runs:
using: composite
steps:
- name: Checkout repository
uses: actions/checkout@v3
# - name: Repo checkout
# uses: actions/checkout@v3

- name: REUSE Compliance Check
uses: fsfe/[email protected]
uses: fsfe/[email protected]

- name: Debug
shell: bash
run: echo 'DEBUG lampss'

# - name: Repo checkout
# uses: actions/checkout@v3
# with:
# repository: splunk/addonfactory-workflow-addon-release
# ref: fix/lightweight-workflow-ADDON-66448
32 changes: 26 additions & 6 deletions .github/actions/meta/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ inputs:
required: true

outputs:
sc4s:
sc4s:
# using fromJSON as below gave an error `error reading JToken from JsonReader` - hence using jq
# value: ghcr.io/${{ github.repository }}/container:${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.version'] }}
# https://github.com/splunk/splunk-add-on-for-microsoft-cloud-services/actions/runs/7019443167/job/19104471863#step:7:4
value: ghcr.io/${{ github.repository }}/container:$(echo "${{ steps.docker_action_meta.outputs.json }}" | jq -r '.labels["org.opencontainers.image.version"]')
value: ghcr.io/${{ github.repository }}/container:$(echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.version"]')
container_tags:
value: ${{ steps.docker_action_meta.outputs.tags }}
container_labels:
value: ${{ steps.docker_action_meta.outputs.labels }}
container_buildtime:
value: $(echo "${{ steps.docker_action_meta.outputs.json }}" | jq -r '.labels["org.opencontainers.image.created"]')
value: $(echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.created"]')
container_version:
value: $(echo "${{ steps.docker_action_meta.outputs.json }}" | jq -r '.labels["org.opencontainers.image.version"]')
value: $(echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.version"]')
container_revision:
value: $(echo "${{ steps.docker_action_meta.outputs.json }}" | jq -r '.labels["org.opencontainers.image.revision"]')
value: $(echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.revision"]')
container_base:
value: $(echo "${{ steps.docker_action_meta.outputs.json }}" | jq -r '.tags[0]')
value: $(echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.tags[0]')
matrix_supportedSplunk:
value: ${{ steps.matrix.outputs.supportedSplunk }}
matrix_latestSplunk:
Expand All @@ -54,6 +54,7 @@ runs:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
submodules: false
persist-credentials: false

Expand Down Expand Up @@ -83,6 +84,18 @@ runs:
type=ref,event=branch
type=ref,event=pr

# - name: Set Docker meta outputs
# id: docker_meta_outputs
# shell: bash
# # echo 'sc4s_version=${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.version"]' >> "$GITHUB_OUTPUT"
# run: |
# outputs_json=${{ steps.docker_action_meta.outputs.json }}
# echo 'sc4s_version=$outputs_json' | jq -r '.labels["org.opencontainers.image.version"]' >> "$GITHUB_OUTPUT"
# echo 'container_buildtime=${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.created"]' >> "$GITHUB_OUTPUT"
# echo 'container_version=${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.version"]' >> "$GITHUB_OUTPUT"
# echo 'container_revision=${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.revision"]' >> "$GITHUB_OUTPUT"
# echo 'container_base=${{ steps.docker_action_meta.outputs.json }}' | jq -r '.tags[0]' >> "$GITHUB_OUTPUT"

- name: matrix
id: matrix
uses: splunk/[email protected]
Expand All @@ -93,3 +106,10 @@ runs:
run: |
echo "splunk={\"version\":\"unreleased-python3_9-a076ce4c50aa\", \"build\":\"a076ce4c50aa\", \"islatest\":false, \"isoldest\":false}" >> "$GITHUB_OUTPUT"
echo "sc4s={\"version\":\"2.49.5\", \"docker_registry\":\"ghcr.io/splunk/splunk-connect-for-syslog/container2\"}" >> "$GITHUB_OUTPUT"

- name: Checkout repository
uses: actions/checkout@v3

- name: Debug outputs
shell: bash
run: echo '${{ steps.docker_action_meta.outputs.json }}' | jq -r '.labels["org.opencontainers.image.version"]'
Loading