mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
ci: copy versionsapi binary from container to host
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
467c3f501c
commit
4a6c64a02f
8
.github/actions/versionsapi/Dockerfile
vendored
8
.github/actions/versionsapi/Dockerfile
vendored
@ -15,12 +15,8 @@ COPY . .
|
||||
WORKDIR /workspace/internal/versionsapi/cli
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o versionsapi .
|
||||
|
||||
FROM alpine:3.17.1@sha256:f271e74b17ced29b915d351685fd4644785c6d1559dd1f2d4189a5e851ef753a as release
|
||||
FROM scratch as release
|
||||
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
WORKDIR /
|
||||
COPY --from=builder /workspace/internal/versionsapi/cli/versionsapi .
|
||||
COPY .github/actions/versionsapi/entrypoint.sh .
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["/notIntendedToBeExecuted"]
|
||||
|
51
.github/actions/versionsapi/action.yml
vendored
51
.github/actions/versionsapi/action.yml
vendored
@ -22,6 +22,9 @@ inputs:
|
||||
version:
|
||||
description: --version flag
|
||||
required: false
|
||||
version_path:
|
||||
description: --version-path flag
|
||||
required: false
|
||||
add_latest:
|
||||
description: --latest flag (boolean)
|
||||
required: false
|
||||
@ -41,17 +44,41 @@ inputs:
|
||||
outputs:
|
||||
output:
|
||||
description: Output of the command
|
||||
value: ${{ steps.run.outputs.output }}
|
||||
|
||||
runs:
|
||||
using: docker
|
||||
image: docker://ghcr.io/edgelesssys/constellation/versionsapi-ci-cli:latest
|
||||
args:
|
||||
- ${{ inputs.command }}
|
||||
- ${{ inputs.ref != '' && format('--ref={0}', inputs.ref) || '' }}
|
||||
- ${{ inputs.stream != '' && format('--stream={0}', inputs.stream) || '' }}
|
||||
- ${{ inputs.version != '' && format('--version={0}', inputs.version) || '' }}
|
||||
- ${{ inputs.add_latest == 'true' && '--latest' || '' }}
|
||||
- ${{ inputs.add_release == 'true' && '--release' || '' }}
|
||||
- ${{ inputs.rm_all == 'true' && '--all' || '' }}
|
||||
- ${{ inputs.dryrun == 'true' && '--dryrun' || '' }}
|
||||
- --verbose
|
||||
using: composite
|
||||
steps:
|
||||
- name: Get versionsapi binary
|
||||
shell: bash
|
||||
run: |
|
||||
containerID=$(docker create "ghcr.io/edgelesssys/constellation/versionsapi-ci-cli:feat-ci-delete-img-main")
|
||||
docker cp ${containerID}:/versionsapi .
|
||||
|
||||
- name: Run versionsapi
|
||||
id: run
|
||||
shell: bash
|
||||
run: |
|
||||
out=$(
|
||||
./versionsapi \
|
||||
${{ inputs.command }} \
|
||||
${{ inputs.ref != '' && format('--ref={0}', inputs.ref) || '' }} \
|
||||
${{ inputs.stream != '' && format('--stream={0}', inputs.stream) || '' }} \
|
||||
${{ inputs.version != '' && format('--version={0}', inputs.version) || '' }} \
|
||||
${{ inputs.version_path != '' && format('--version-path={0}', inputs.version_path) || '' }} \
|
||||
${{ inputs.add_latest == 'true' && '--latest' || '' }} \
|
||||
${{ inputs.add_release == 'true' && '--release' || '' }} \
|
||||
${{ inputs.rm_all == 'true' && '--all' || '' }} \
|
||||
${{ inputs.dryrun == 'true' && '--dryrun' || '' }}
|
||||
)
|
||||
|
||||
# Multiline output is not supported by GitHub Actions,
|
||||
# and if we encode it, it is redacted as secret. 🤦
|
||||
# So we have to workaround by writing it to a file.
|
||||
|
||||
if [[ ${{ inputs.command == 'list' }} ]]; then
|
||||
echo "$out" > versionsapi_output.txt
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "output=${outJSON}" >> "$GITHUB_OUTPUT"
|
||||
|
18
.github/actions/versionsapi/entrypoint.sh
vendored
18
.github/actions/versionsapi/entrypoint.sh
vendored
@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
for arg in "$@"; do
|
||||
if [[ ${arg} != "" ]]; then
|
||||
args[${#args[@]}]="${arg}"
|
||||
fi
|
||||
done
|
||||
|
||||
out=$(/versionsapi "${args[@]}")
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ${GITHUB_ACTIONS} == "true" ]]; then
|
||||
echo "output=${out}" | tee "${GITHUB_ENV}"
|
||||
else
|
||||
echo "${out}"
|
||||
fi
|
9
.github/workflows/versionsapi.yml
vendored
9
.github/workflows/versionsapi.yml
vendored
@ -24,6 +24,10 @@ on:
|
||||
description: --version flag
|
||||
required: false
|
||||
type: string
|
||||
version_path:
|
||||
description: --version-path flag
|
||||
required: false
|
||||
type: string
|
||||
add_latest:
|
||||
description: --latest flag
|
||||
required: false
|
||||
@ -62,6 +66,10 @@ on:
|
||||
description: --version flag
|
||||
required: false
|
||||
type: string
|
||||
version_path:
|
||||
description: --version-path flag
|
||||
required: false
|
||||
type: string
|
||||
add_latest:
|
||||
description: --latest flag
|
||||
required: false
|
||||
@ -172,6 +180,7 @@ jobs:
|
||||
ref: ${{ inputs.ref }}
|
||||
stream: ${{ inputs.stream }}
|
||||
version: ${{ inputs.version }}
|
||||
version_path: ${{ inputs.version_path }}
|
||||
add_latest: ${{ inputs.add_latest }}
|
||||
add_release: ${{ inputs.add_release }}
|
||||
rm_all: ${{ inputs.rm_all }}
|
||||
|
Loading…
Reference in New Issue
Block a user