Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ jobs:
name: Test regctl install
strategy:
matrix:
version: ["latest", "main", "v0.4.7"]
version: ["latest", "main", "v0.5.7"]
os: [macos-latest, ubuntu-latest, windows-latest]
env:
example_user: "demo$user"
example_pass: "example$pass\\word'\"with#special&chars"
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
Expand Down Expand Up @@ -37,7 +40,15 @@ jobs:
- name: Login
uses: ./regctl-login/

- name: Check root directory
- name: Login
uses: ./regctl-login/
with:
registry: "localhost:5000"
username: "${{ env.example_user }}"
password: "${{ env.example_pass }}"
options: "--skip-check"

- name: Check the git working directory
shell: bash
run: |
if [[ $(git diff --stat) != '' ]]; then
Expand All @@ -46,3 +57,23 @@ jobs:
else
exit 0
fi

- name: Verify credentials were set
shell: bash
env:
expect_gh_user: ${{ github.actor }}
expect_gh_token: ${{ github.token }}
run: |
gh_user="$(jq -r '.hosts."ghcr.io".user' <~/.regctl/config.json)"
gh_token="$(jq -r '.hosts."ghcr.io".pass' <~/.regctl/config.json)"
echo "::add-mask::$gh_token"
if [ "$gh_user" != "$expect_gh_user" ] || [ "$gh_token" != "$expect_gh_token" ]; then
echo "default login did not save expected values" >&2
exit 1
fi
local_user="$(jq -r '.hosts."localhost:5000".user' <~/.regctl/config.json)"
local_pass="$(jq -r '.hosts."localhost:5000".pass' <~/.regctl/config.json)"
if [ "$local_user" != "$example_user" ] || [ "$local_pass" != "${example_pass}" ]; then
echo "localhost:5000 login did not save expected values" >&2
exit 1
fi
10 changes: 9 additions & 1 deletion regctl-login/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ inputs:
description: password to login with
required: false
default: ${{ github.token }}
options:
description: options for regctl registry login, e.g. --skip-check
required: false
runs:
using: 'composite'
steps:
- shell: bash
env:
REGISTRY: ${{ inputs.registry }}
USERNAME: ${{ inputs.username }}
PASSWORD: ${{ inputs.password }}
run: |
echo "${{ inputs.password }}" | regctl registry login "${{ inputs.registry }}" -u "${{ inputs.username }}" --pass-stdin
echo "::add-mask::${PASSWORD}"
echo "${PASSWORD}" | regctl registry login "${REGISTRY}" -u "${USERNAME}" --pass-stdin ${{ inputs.options }}