Fix docker images publishing (#11260)

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
This commit is contained in:
Julien Pivotto 2022-09-06 12:27:31 +02:00 committed by GitHub
parent 58b7c890a1
commit fc1a36d476
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 54 additions and 20 deletions

View file

@ -18,7 +18,6 @@ runs:
- uses: ./.github/actions/setup_environment
- run: ~/go/bin/promu crossbuild -v --parallelism ${{ inputs.parallelism }} --parallelism-thread ${{ inputs.thread }} ${{ inputs.promu_opts }}
shell: bash
- uses: actions/upload-artifact@v3
- uses: ./.github/actions/save_artefacts
with:
path: |
.build
directory: .build

View file

@ -29,14 +29,16 @@ runs:
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
with:
name: artifact
- uses: ./.github/actions/setup_environment
- if: "inputs.dockerfile_path != ''"
- if: inputs.dockerfile_path != ''
run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" >> /tmp/tmp-profile
shell: bash
- if: "inputs.container_image_name != ''"
- if: inputs.container_image_name != ''
run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" >> /tmp/tmp-profile
shell: bash
- if: "inputs.dockerbuild_context != ''"
- if: inputs.dockerbuild_context != ''
run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" >> /tmp/tmp-profile
shell: bash
- run: |

View file

@ -24,6 +24,8 @@ runs:
using: composite
steps:
- uses: ./.github/actions/setup_environment
with:
enable_docker_multibuild: true
- uses: ./.github/actions/publish_images
if: inputs.docker_hub_organization != '' && inputs.docker_hub_login != ''
with:

View file

@ -24,6 +24,8 @@ runs:
using: composite
steps:
- uses: ./.github/actions/setup_environment
with:
enable_docker_multibuild: true
- run: promu crossbuild tarballs
shell: bash
- run: promu checksum .tarballs

View file

@ -29,15 +29,17 @@ runs:
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
with:
name: artifact
- uses: ./.github/actions/setup_environment
- if: "inputs.dockerfile_path != ''"
run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" }} /tmp/tmp-profile
- if: inputs.dockerfile_path != ''
run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" >> /tmp/tmp-profile
shell: bash
- if: "inputs.container_image_name != ''"
run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" }} /tmp/tmp-profile
- if: inputs.container_image_name != ''
run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" >> /tmp/tmp-profile
shell: bash
- if: "inputs.dockerbuild_context != ''"
run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" }} /tmp/tmp-profile
- if: inputs.dockerbuild_context != ''
run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" >> /tmp/tmp-profile
shell: bash
- run: |
current_tag=${GITHUB_REF#refs/*/}

View file

@ -0,0 +1,18 @@
# To preserve the directory structure, save an additional empty file at
# the root of the working directory. GitHub action uses the least common
# ancestor of all the search paths as the root directory for artefacts.
name: Save artefacts
inputs:
directory:
type: string
description: Path of the directory to save
runs:
using: composite
steps:
- run: touch .keep
shell: bash
- uses: actions/upload-artifact@v3
with:
path: |
${{ inputs.directory }}
.keep

View file

@ -7,12 +7,16 @@ inputs:
enable_npm:
type: boolean
description: Whether to enable npm specific features, such as caching.
default: true
default: false
enable_docker_multibuild:
type: boolean
description: Whether to enable multibuild docker
default: false
runs:
using: composite
steps:
- uses: actions/cache@v3
if: ${{ inputs.enable_go }}
if: inputs.enable_go == 'true'
with:
path: |
~/.cache/go-build
@ -21,7 +25,7 @@ runs:
restore-keys: |
${{ runner.os }}-go-
- uses: actions/cache@v3
if: ${{ inputs.enable_npm }}
if: inputs.enable_npm == 'true'
with:
path: |
~/.npm
@ -30,4 +34,10 @@ runs:
${{ runner.os }}-npm-
- run: make promu
shell: bash
if: ${{ inputs.enable_go }}
if: inputs.enable_go == 'true'
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
if: inputs.enable_docker_multibuild == 'true'
- name: Set up buildx
uses: docker/setup-buildx-action@v1
if: inputs.enable_docker_multibuild == 'true'

View file

@ -37,10 +37,9 @@ jobs:
- run: make assets-tarball
- run: make ui-lint
- run: make ui-test
- uses: actions/upload-artifact@v3
- uses: ./.github/actions/save_artefacts
with:
path: |
.tarballs
directory: .tarballs
test_windows:
runs-on: windows-latest

View file

@ -205,7 +205,7 @@ common-tarball: promu
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
common-docker: $(BUILD_DOCKER_ARCHS)
$(BUILD_DOCKER_ARCHS): common-docker-%:
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \
docker buildx build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \
-f $(DOCKERFILE_PATH) \
--build-arg ARCH="$*" \
--build-arg OS="linux" \