Browse Source

Fix docker images publishing (#11260)

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
pull/11263/head
Julien Pivotto 2 years ago committed by GitHub
parent
commit
fc1a36d476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .github/actions/build/action.yml
  2. 8
      .github/actions/publish_images/action.yml
  3. 2
      .github/actions/publish_main/action.yml
  4. 2
      .github/actions/publish_release/action.yml
  5. 14
      .github/actions/publish_release_image/action.yml
  6. 18
      .github/actions/save_artefacts/action.yml
  7. 18
      .github/actions/setup_environment/action.yml
  8. 5
      .github/workflows/test.yml
  9. 2
      Makefile.common

5
.github/actions/build/action.yml

@ -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

8
.github/actions/publish_images/action.yml

@ -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: |

2
.github/actions/publish_main/action.yml

@ -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:

2
.github/actions/publish_release/action.yml

@ -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

14
.github/actions/publish_release_image/action.yml

@ -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/*/}

18
.github/actions/save_artefacts/action.yml

@ -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

18
.github/actions/setup_environment/action.yml

@ -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'

5
.github/workflows/test.yml

@ -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

2
Makefile.common

@ -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" \

Loading…
Cancel
Save