From f8aa6610dea1906e2ffe25763d5e0d49d7d61760 Mon Sep 17 00:00:00 2001 From: shimataro Date: Sun, 21 Mar 2021 14:56:48 +0900 Subject: [PATCH] Feature/verify on container alpine (#180) * support Alpine Docker container * add Git package * update README * update README; add install commands * update CHANGELOG * fix typo * fix typo --- .../workflows/verify-on-container-alpine.yml | 303 ++++++++++++++++++ .../workflows/verify-on-container-ubuntu.yml | 18 +- CHANGELOG.md | 1 + README.md | 8 +- 4 files changed, 319 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/verify-on-container-alpine.yml diff --git a/.github/workflows/verify-on-container-alpine.yml b/.github/workflows/verify-on-container-alpine.yml new file mode 100644 index 0000000..1dab348 --- /dev/null +++ b/.github/workflows/verify-on-container-alpine.yml @@ -0,0 +1,303 @@ +# https://help.github.com/en/articles/workflow-syntax-for-github-actions + +name: Docker container (Alpine Linux) + +on: +- push + +jobs: + ssh-pem: + name: Connect to github.com (PEM format) + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + strategy: + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + - ubuntu-20.04 + container: + - alpine:3.10 + - alpine:3.11 + - alpine:3.12 + - alpine:3.13 + fail-fast: false + steps: + - name: Install packages + run: apk add openssh-client git + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Install SSH key + uses: ./. + with: + key: ${{ secrets.SSH_KEY_PEM }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + - name: print created files + run: ls -l /root/.ssh + - name: git clone through SSH + run: git clone git@github.com:shimataro/ssh-key-action.git tmp + ssh-pkcs8: + name: Connect to github.com (PKCS8 format) + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + strategy: + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + - ubuntu-20.04 + container: + - alpine:3.10 + - alpine:3.11 + - alpine:3.12 + - alpine:3.13 + fail-fast: false + steps: + - name: Install packages + run: apk add openssh-client git + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Install SSH key + uses: ./. + with: + key: ${{ secrets.SSH_KEY_PKCS8 }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + - name: print created files + run: ls -l /root/.ssh + - name: git clone through SSH + run: git clone git@github.com:shimataro/ssh-key-action.git tmp + ssh-rfc4716: + name: Connect to github.com (RFC4716 format) + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + strategy: + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + - ubuntu-20.04 + container: + - alpine:3.10 + - alpine:3.11 + - alpine:3.12 + - alpine:3.13 + fail-fast: false + steps: + - name: Install packages + run: apk add openssh-client git + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Install SSH key + uses: ./. + with: + key: ${{ secrets.SSH_KEY_RFC4716 }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + - name: print created files + run: ls -l /root/.ssh + - name: git clone through SSH + run: git clone git@github.com:shimataro/ssh-key-action.git tmp + + key_if_exists_replace-key_exists: + name: if_key_exists=replace / key exists + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + - ubuntu-20.04 + container: + - alpine:3.10 + - alpine:3.11 + - alpine:3.12 + - alpine:3.13 + steps: + - name: Install packages + run: apk add openssh-client git + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Install SSH key (dummy) + uses: ./. + with: + key: "dummy" # replaced + known_hosts: ${{ secrets.KNOWN_HOSTS }} + - name: Install SSH key (replace) + uses: ./. + with: + key: ${{ secrets.SSH_KEY_PEM }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: replace + - name: print created files + run: ls -l /root/.ssh + - name: git clone through SSH + run: git clone git@github.com:shimataro/ssh-key-action.git tmp + key_if_exists_replace-key_doesnt_exist: + name: if_key_exists=replace / key doesn't exist + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + - ubuntu-20.04 + container: + - alpine:3.10 + - alpine:3.11 + - alpine:3.12 + - alpine:3.13 + steps: + - name: Install packages + run: apk add openssh-client git + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Install SSH key (replace) + uses: ./. + with: + key: ${{ secrets.SSH_KEY_PEM }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: replace + - name: print created files + run: ls -l /root/.ssh + - name: git clone through SSH + run: git clone git@github.com:shimataro/ssh-key-action.git tmp + + key_if_exists_ignore-key_exists: + name: if_key_exists=ignore / key exists + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + - ubuntu-20.04 + container: + - alpine:3.10 + - alpine:3.11 + - alpine:3.12 + - alpine:3.13 + steps: + - name: Install packages + run: apk add openssh-client git + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Install SSH key (dummy) + uses: ./. + with: + key: ${{ secrets.SSH_KEY_PEM }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + - name: Install SSH key (replace) + uses: ./. + with: + key: "dummy" # ignored + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: ignore + - name: print created files + run: ls -l /root/.ssh + - name: git clone through SSH + run: git clone git@github.com:shimataro/ssh-key-action.git tmp + key_if_exists_ignore-key_doesnt_exist: + name: if_key_exists=ignore / key doesn't exist + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + - ubuntu-20.04 + container: + - alpine:3.10 + - alpine:3.11 + - alpine:3.12 + - alpine:3.13 + steps: + - name: Install packages + run: apk add openssh-client git + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Install SSH key (replace) + uses: ./. + with: + key: ${{ secrets.SSH_KEY_PEM }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: ignore + - name: print created files + run: ls -l /root/.ssh + - name: git clone through SSH + run: git clone git@github.com:shimataro/ssh-key-action.git tmp + + key_if_exists_fail-key_exists: + name: if_key_exists=fail / key exists + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + - ubuntu-20.04 + container: + - alpine:3.10 + - alpine:3.11 + - alpine:3.12 + - alpine:3.13 + steps: + - name: Install packages + run: apk add openssh-client git + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Install SSH key (dummy) + uses: ./. + with: + key: ${{ secrets.SSH_KEY_PEM }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + - name: Install SSH key (replace) + uses: ./. + with: + key: "dummy" # ignored + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: fail + continue-on-error: true + - name: print created files + run: ls -l /root/.ssh + - name: git clone through SSH + run: git clone git@github.com:shimataro/ssh-key-action.git tmp + key_if_exists_fail-key_doesnt_exist: + name: if_key_exists=fail / key doesn't exist + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + - ubuntu-20.04 + container: + - alpine:3.10 + - alpine:3.11 + - alpine:3.12 + - alpine:3.13 + steps: + - name: Install packages + run: apk add openssh-client git + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Install SSH key (replace) + uses: ./. + with: + key: ${{ secrets.SSH_KEY_PEM }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: fail + - name: print created files + run: ls -l /root/.ssh + - name: git clone through SSH + run: git clone git@github.com:shimataro/ssh-key-action.git tmp diff --git a/.github/workflows/verify-on-container-ubuntu.yml b/.github/workflows/verify-on-container-ubuntu.yml index e6f13fb..0cae861 100644 --- a/.github/workflows/verify-on-container-ubuntu.yml +++ b/.github/workflows/verify-on-container-ubuntu.yml @@ -25,7 +25,7 @@ jobs: - name: Install packages run: | apt update - apt -y install openssh-client git + apt install -y openssh-client git - name: Checkout source codes uses: actions/checkout@v2 - name: Install SSH key @@ -56,7 +56,7 @@ jobs: - name: Install packages run: | apt update - apt -y install openssh-client git + apt install -y openssh-client git - name: Checkout source codes uses: actions/checkout@v2 - name: Install SSH key @@ -87,7 +87,7 @@ jobs: - name: Install packages run: | apt update - apt -y install openssh-client git + apt install -y openssh-client git - name: Checkout source codes uses: actions/checkout@v2 - name: Install SSH key @@ -119,7 +119,7 @@ jobs: - name: Install packages run: | apt update - apt -y install openssh-client git + apt install -y openssh-client git - name: Checkout source codes uses: actions/checkout@v2 - name: Install SSH key (dummy) @@ -156,7 +156,7 @@ jobs: - name: Install packages run: | apt update - apt -y install openssh-client git + apt install -y openssh-client git - name: Checkout source codes uses: actions/checkout@v2 - name: Install SSH key (replace) @@ -189,7 +189,7 @@ jobs: - name: Install packages run: | apt update - apt -y install openssh-client git + apt install -y openssh-client git - name: Checkout source codes uses: actions/checkout@v2 - name: Install SSH key (dummy) @@ -226,7 +226,7 @@ jobs: - name: Install packages run: | apt update - apt -y install openssh-client git + apt install -y openssh-client git - name: Checkout source codes uses: actions/checkout@v2 - name: Install SSH key (replace) @@ -259,7 +259,7 @@ jobs: - name: Install packages run: | apt update - apt -y install openssh-client git + apt install -y openssh-client git - name: Checkout source codes uses: actions/checkout@v2 - name: Install SSH key (dummy) @@ -297,7 +297,7 @@ jobs: - name: Install packages run: | apt update - apt -y install openssh-client git + apt install -y openssh-client git - name: Checkout source codes uses: actions/checkout@v2 - name: Install SSH key (replace) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0faf1e..d22faa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added * `if_key_exists` parameter +* Support Alpine Linux Docker container ## [2.2.0] - 2021-02-27 diff --git a/README.md b/README.md index 7541c3e..b5e019c 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![Ubuntu][image-verify-ubuntu]][link-verify-ubuntu] [![Docker container (Ubuntu)][image-verify-docker-container-ubuntu]][link-verify-docker-container-ubuntu] [![Docker container (CentOS)][image-verify-docker-container-centos]][link-verify-docker-container-centos] +[![Docker container (Alpine Linux)][image-verify-docker-container-alpine]][link-verify-docker-container-alpine] [![Release][image-release]][link-release] [![License][image-license]][link-license] [![Stars][image-stars]][link-stars] @@ -17,8 +18,9 @@ Useful for SCP, SFTP, and `rsync` over SSH in deployment script. tested on: * [all available virtual machines](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources) (Windows Server 2019, macOS Catalina, and Ubuntu 20.04/18.04/16.04) -* [Docker container (Ubuntu)](https://hub.docker.com/_/ubuntu) / requires `openssh-client` package -* [Docker container (CentOS)](https://hub.docker.com/_/centos) / requires `openssh-clients` package +* [Docker container (Ubuntu)](https://hub.docker.com/_/ubuntu) / requires `openssh-client` package; `apt install -y openssh-client` +* [Docker container (CentOS)](https://hub.docker.com/_/centos) / requires `openssh-clients` package; `yum install -y openssh-clients` +* [Docker container (Alpine Linux)](https://hub.docker.com/_/alpine) / requires `openssh-client` package; `apk add openssh-client` ## Usage @@ -151,6 +153,8 @@ See [CHANGELOG.md](CHANGELOG.md). [link-verify-docker-container-ubuntu]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-ubuntu.yml [image-verify-docker-container-centos]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-centos.yml/badge.svg?event=push&branch=v2 [link-verify-docker-container-centos]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-centos.yml +[image-verify-docker-container-alpine]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-alpine.yml/badge.svg?event=push&branch=v2 +[link-verify-docker-container-alpine]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-alpine.yml [image-release]: https://img.shields.io/github/release/shimataro/ssh-key-action.svg [link-release]: https://github.com/shimataro/ssh-key-action/releases [image-license]: https://img.shields.io/github/license/shimataro/ssh-key-action.svg