From 184d5f4bcf6035e441545968457b61f820efe1c1 Mon Sep 17 00:00:00 2001 From: elgohr Date: Tue, 13 Apr 2021 11:38:35 +0200 Subject: [PATCH] :recycle: Remove platforms options Platform was in beta and turned out not to be usable. This still needs some tinkering with Github actions, but this wouldn't happen here. See https://github.com/actions/virtual-environments/issues/3090 --- Dockerfile | 3 +-- README.md | 11 ----------- action.yml | 3 --- entrypoint.sh | 16 +--------------- test.bats | 18 ------------------ 5 files changed, 2 insertions(+), 49 deletions(-) diff --git a/Dockerfile b/Dockerfile index 47de0ac..477ef39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ LABEL "maintainer"="Lars Gohr" RUN apk update \ && apk upgrade \ - && apk add --no-cache git sudo + && apk add --no-cache git ADD entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] @@ -14,7 +14,6 @@ RUN apk add --no-cache coreutils bats ADD test.bats /test.bats ADD mock.sh /usr/local/bin/docker ADD mock.sh /usr/bin/date -ADD mock.sh /usr/bin/sudo RUN /test.bats FROM runtime diff --git a/README.md b/README.md index 59af6dd..3b8b9c7 100644 --- a/README.md +++ b/README.md @@ -188,17 +188,6 @@ with: no_push: ${{ github.event_name == 'push' }} ``` -### platforms -Use `platforms` when you want to build a multi-platform image (separated by comma). - -```yaml -with: - name: myDocker/repository - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - platforms: linux/amd64,linux/arm64 -``` - ### Tags This action supports multiple options that tags are handled. diff --git a/action.yml b/action.yml index b819a96..290d2ee 100644 --- a/action.yml +++ b/action.yml @@ -44,9 +44,6 @@ inputs: tags: description: 'Use tags when you want to bring your own tags (separated by comma)' required: false - platforms: - description: 'Use platforms to build multi-platform images (separated by comma)' - required: false tag_names: description: 'Use tag_names when you want to push tags/release by their git name' required: false diff --git a/entrypoint.sh b/entrypoint.sh index fddcc66..8b8aa9c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,10 +16,6 @@ main() { sanitize "${INPUT_PASSWORD}" "password" fi - if uses "${INPUT_PLATFORMS}"; then - enableExperimentalDocker - fi - registryToLower nameToLower @@ -88,11 +84,6 @@ sanitize() { fi } -enableExperimentalDocker() { - echo $'{"experimental": true}' | sudo dd status=none of=/etc/docker/daemon.json - sudo service docker restart -} - registryToLower(){ INPUT_REGISTRY=$(echo "${INPUT_REGISTRY}" | tr '[A-Z]' '[a-z]') } @@ -199,12 +190,7 @@ build() { for TAG in ${TAGS}; do BUILD_TAGS="${BUILD_TAGS}-t ${INPUT_NAME}:${TAG} " done - if uses "${INPUT_PLATFORMS}"; then - local PLATFORMS="--platform ${INPUT_PLATFORMS}" - docker buildx build ${PLATFORMS} ${INPUT_BUILDOPTIONS} ${BUILDPARAMS} ${BUILD_TAGS} ${CONTEXT} - else - docker build ${INPUT_BUILDOPTIONS} ${BUILDPARAMS} ${BUILD_TAGS} ${CONTEXT} - fi + docker build ${INPUT_BUILDOPTIONS} ${BUILDPARAMS} ${BUILD_TAGS} ${CONTEXT} } push() { diff --git a/test.bats b/test.bats index 94b34b2..92402ac 100755 --- a/test.bats +++ b/test.bats @@ -656,24 +656,6 @@ teardown() { /usr/local/bin/docker logout" } -@test "it supports building multiple platforms" { - export GITHUB_REF='refs/heads/main' - export INPUT_PLATFORMS='linux/amd64,linux/arm64' - - run /entrypoint.sh - - expectStdOutContains "::set-output name=tag::latest" - - expectMockCalledContains "/usr/bin/sudo dd status=none of=/etc/docker/daemon.json -/usr/bin/sudo service docker restart -/usr/local/bin/docker login -u USERNAME --password-stdin -/usr/local/bin/docker buildx build --platform linux/amd64,linux/arm64 -t my/repository:latest . -/usr/local/bin/docker push my/repository:latest -/usr/local/bin/docker inspect --format={{index .RepoDigests 0}} my/repository:latest -/usr/local/bin/docker logout" - expectMockArgs '/usr/bin/sudo {"experimental": true}' -} - expectStdOutIs() { local expected=$(echo "${1}" | tr -d '\n') local got=$(echo "${output}" | tr -d '\n')