added some protections against error cases

Dieser Commit ist enthalten in:
Sebastian Tobie 2025-02-02 13:08:45 +01:00
Ursprung 2ed258922d
Commit 816f9ed857
2 geänderte Dateien mit 14 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -33,7 +33,12 @@ runs:
steps:
- name: login
shell: sh
run: 'skopeo login -u "${{ inputs.username }}" -p "${{ inputs.password }}" ${{ inputs.registry }}'
run: |
if [ -z "${{ inputs.password }}" ] ; then
echo The password is unset
exit 1
fi
skopeo login -u "${{ inputs.username }}" -p "${{ inputs.password }}" ${{ inputs.registry }}
env:
REGISTRY_AUTH_FILE: ${{env.RUNNER_TEMP}}/auth.json
- name: skopeo copy

Datei anzeigen

@ -5,6 +5,7 @@ init_container () {
local container_name="$1"
local image="$2"
buildah from -q -v "$empty_dir":/tmp:slave -v "$empty_dir":/var/cache:slave -v "$empty_dir":/var/tmp:slave -v "$empty_dir":/var/log:slave --pull=newer --name="$container_name" "${image}" >/dev/null
remove_container_on_exit "$container_name"
buildah run --user 0:0 "$container_name" chmod -c 1777 /tmp /var/tmp
buildah run --user 0:0 "$container_name" touch /tmp/test
}
@ -13,4 +14,11 @@ commit(){
buildah config -e - -l - -a - -p - "$1"
buildah config -e PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin" "$1"
buildah commit --rm -f oci --squash "$1" "$2"
trap - EXIT
}
remove_container_on_exit() {
container="$1"
# shellcheck disable=SC2064
trap "buildah rm ${container}" EXIT
}