From 118e02f506bed76782a6a407ed2058563035988f Mon Sep 17 00:00:00 2001 From: Rammus Xu Date: Tue, 30 Jun 2020 17:48:07 +0800 Subject: [PATCH 1/4] Fix python2 --- gcloud/login/Dockerfile | 3 +-- gcloud/login/entrypoint.sh | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gcloud/login/Dockerfile b/gcloud/login/Dockerfile index ec6f3b0..c7d77b6 100644 --- a/gcloud/login/Dockerfile +++ b/gcloud/login/Dockerfile @@ -11,8 +11,7 @@ LABEL "com.github.actions.icon"="terminal" LABEL "com.github.actions.color"="green" -RUN apk update && \ - apk add curl bash python git && \ +RUN apk add curl python2 && \ curl https://sdk.cloud.google.com | bash -s -- --disable-prompts ENV PATH $PATH:/root/google-cloud-sdk/bin diff --git a/gcloud/login/entrypoint.sh b/gcloud/login/entrypoint.sh index 9ea054a..d986fde 100755 --- a/gcloud/login/entrypoint.sh +++ b/gcloud/login/entrypoint.sh @@ -8,4 +8,4 @@ gcloud auth activate-service-account --key-file=gcloud.json # https://cloud.google.com/container-registry/docs/advanced-authentication cat gcloud.json | docker login -u _json_key --password-stdin https://asia.gcr.io -bash -c "$*" \ No newline at end of file +sh -c "$*" From 1fd67dbf4d958bcf638752357385d19978f2e84c Mon Sep 17 00:00:00 2001 From: Rammus Xu Date: Tue, 30 Jun 2020 17:50:17 +0800 Subject: [PATCH 2/4] Clean --- gcloud/login/Dockerfile | 10 ---------- gcloud/login/action.yaml | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/gcloud/login/Dockerfile b/gcloud/login/Dockerfile index c7d77b6..4b20d03 100644 --- a/gcloud/login/Dockerfile +++ b/gcloud/login/Dockerfile @@ -1,16 +1,6 @@ FROM docker:stable -LABEL version="1.0.0" - -LABEL "version"="1.0.0" -LABEL "maintainer"="Rammus Xu " -LABEL "com.github.actions.name"="GCR Login" -LABEL "com.github.actions.description"="use GCLOUD_AUTH" -LABEL "com.github.actions.icon"="terminal" -LABEL "com.github.actions.color"="green" - - RUN apk add curl python2 && \ curl https://sdk.cloud.google.com | bash -s -- --disable-prompts diff --git a/gcloud/login/action.yaml b/gcloud/login/action.yaml index 40ddb1a..f899984 100644 --- a/gcloud/login/action.yaml +++ b/gcloud/login/action.yaml @@ -1,9 +1,9 @@ # action.yml name: 'GCloud Login' -description: 'Login GCloud' +description: 'Login Google Cloud Platform' runs: using: 'docker' image: 'Dockerfile' branding: - icon: 'package' - color: 'blue' \ No newline at end of file + icon: 'package' + color: 'blue' From a615f7ef389537e7579f6e66b8bc643f4ee5b454 Mon Sep 17 00:00:00 2001 From: Rammus Xu Date: Tue, 30 Jun 2020 17:50:27 +0800 Subject: [PATCH 3/4] Add workflow --- .github/workflows/test_gcloud_login.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/test_gcloud_login.yaml diff --git a/.github/workflows/test_gcloud_login.yaml b/.github/workflows/test_gcloud_login.yaml new file mode 100644 index 0000000..a6db72e --- /dev/null +++ b/.github/workflows/test_gcloud_login.yaml @@ -0,0 +1,12 @@ +name: Test gcloud-login +on: + push: + paths: + - "gcloud/login/**" +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run tests + run: docker build gcloud/login From 1cd1a9363dcf27f673b277e5efcd7340fe1b6fcb Mon Sep 17 00:00:00 2001 From: Rammus Xu Date: Tue, 30 Jun 2020 17:53:52 +0800 Subject: [PATCH 4/4] Install google sdk need bash --- gcloud/login/Dockerfile | 2 +- gcloud/login/entrypoint.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcloud/login/Dockerfile b/gcloud/login/Dockerfile index 4b20d03..0d89ccc 100644 --- a/gcloud/login/Dockerfile +++ b/gcloud/login/Dockerfile @@ -1,7 +1,7 @@ FROM docker:stable -RUN apk add curl python2 && \ +RUN apk add curl bash python2 && \ curl https://sdk.cloud.google.com | bash -s -- --disable-prompts ENV PATH $PATH:/root/google-cloud-sdk/bin diff --git a/gcloud/login/entrypoint.sh b/gcloud/login/entrypoint.sh index d986fde..097957f 100755 --- a/gcloud/login/entrypoint.sh +++ b/gcloud/login/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e echo "$GCLOUD_AUTH" | base64 -d > gcloud.json @@ -8,4 +8,4 @@ gcloud auth activate-service-account --key-file=gcloud.json # https://cloud.google.com/container-registry/docs/advanced-authentication cat gcloud.json | docker login -u _json_key --password-stdin https://asia.gcr.io -sh -c "$*" +bash -c "$*"