Ajoute la possibilité de pousser avec skopeo

This commit is contained in:
2025-12-26 12:40:24 +01:00
parent a43e1e5361
commit 4455eef915

View File

@@ -1,5 +1,5 @@
name: 'Build a docker image to a registry server' name: 'Push a docker image to a registry server'
description: 'Build a docker image to a registry server using podman or docker' description: 'Push a docker image to a registry server using podman, docker, or skopeo'
author: 'Eric Coissac' author: 'Eric Coissac'
inputs: inputs:
@@ -68,7 +68,7 @@ runs:
registry_password: ${{ inputs.registry_password }} registry_password: ${{ inputs.registry_password }}
debug: ${{ inputs.debug }} debug: ${{ inputs.debug }}
- name: Push the images to the serveur - name: Push the images to the serveur
shell: bash shell: bash
run: | run: |
source "${{ github.action_path }}/../bashlib.sh" source "${{ github.action_path }}/../bashlib.sh"
@@ -86,12 +86,23 @@ runs:
step "Start pushing" "${{ inputs.image_name }}" step "Start pushing" "${{ inputs.image_name }}"
for tag in "${tags[@]}" ; do for tag in "${tags[@]}" ; do
if ${{ inputs.push_command }} push ${{ inputs.registry_server }}/${{ inputs.image_name }}:$tag ; then if [[ "${{ inputs.push_command }}" == "skopeo" ]] ; then
success "Image pushing" "${{ inputs.image_name }}:${tag}" # Pour skopeo, on utilise 'copy' avec docker-daemon: comme source
source_image="docker-daemon:${{ inputs.registry_server }}/${{ inputs.image_name }}:${tag}"
dest_image="docker://${{ inputs.registry_server }}/${{ inputs.image_name }}:${tag}"
if skopeo copy "${source_image}" "${dest_image}" ; then
success "Image pushing" "${{ inputs.image_name }}:${tag}"
else
error "Failed" "pushing of image ${{ inputs.image_name }}:${tag}"
fi
else else
error "Failed" "pushing of image ${{ inputs.image_name }}:${tag}" # Pour podman ou docker, on utilise la syntaxe classique 'push'
if ${{ inputs.push_command }} push ${{ inputs.registry_server }}/${{ inputs.image_name }}:${tag} ; then
success "Image pushing" "${{ inputs.image_name }}:${tag}"
else
error "Failed" "pushing of image ${{ inputs.image_name }}:${tag}"
fi
fi fi
done done