mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-28 15:21:29 +05:30
Compare commits
81 Commits
v0.9.2
..
16a8c2ce61
| Author | SHA1 | Date | |
|---|---|---|---|
| 16a8c2ce61 | |||
| 164ec8c494 | |||
| defdb5e2f5 | |||
| 28e11f3745 | |||
| e3d1da694f | |||
| 98a1b9ce53 | |||
| ca21698edc | |||
| 300c1b491f | |||
| 14b6d371c9 | |||
| bfd43cacbb | |||
| 7b43509f5b | |||
| 5ad51ee4a4 | |||
| 5b6a1880fa | |||
| 29038b4df4 | |||
| 955f6c518d | |||
| 0202e5a960 | |||
| 4e2b0ff14f | |||
| 8fe8d458f7 | |||
| af758c414c | |||
| dc6f4f5cb9 | |||
| 4e68cd824e | |||
| d520877610 | |||
| f0e4adbf36 | |||
| bf6137df6b | |||
| 2b4e08bca3 | |||
| 62deeb49c1 | |||
| 6ca9924445 | |||
| 806dc5f678 | |||
| a7b23cd2b5 | |||
| 178a3a4e57 | |||
| f5fd80af0f | |||
| ae163ade7b | |||
| b871f76540 | |||
| 50c1460bf5 | |||
| aecf6e5780 | |||
| ecf6c1ccc7 | |||
| b844409a12 | |||
| 9df2c7782a | |||
| 7a15b77bcb | |||
| 81f7ebebfd | |||
| 3f97cf3ce3 | |||
| 8b5e6dffc6 | |||
| 4741f33d28 | |||
| 78303955b8 | |||
| 9b0c242b5c | |||
| 057ed818a9 | |||
| b7a754b9ff | |||
| 62777f0887 | |||
| 9d04e49561 | |||
| bc131d729d | |||
| 84c3413e0e | |||
| fcb0b664b5 | |||
| cf4e41fbb0 | |||
| 53f7bdc3fa | |||
| d4602cd917 | |||
| ae84c25786 | |||
| 2adf3cf9aa | |||
| 1fdce4c733 | |||
| 962a779645 | |||
| ec5efac3ca | |||
| 8154b98959 | |||
| d075f3cecc | |||
| fdddb02817 | |||
| c07513a69d | |||
| 4142982fb8 | |||
| 860f1459e3 | |||
| d378d46316 | |||
| 4c97a761df | |||
| b61abf1cb8 | |||
| 85841ea0ce | |||
| c32e697324 | |||
| d770c60191 | |||
| 5095e43ecf | |||
| 00313838c6 | |||
| bcf656656f | |||
| fd27520bbd | |||
| 4849c2328b | |||
| 2e8005f3a7 | |||
| 5d4d5150ae | |||
| f9d3010165 | |||
| e7bd3957ae |
+40
-23
@@ -1,5 +1,14 @@
|
|||||||
name: build
|
name: build
|
||||||
|
|
||||||
|
# Default to 'contents: read', which grants actions to read commits.
|
||||||
|
#
|
||||||
|
# If any permission is set, any permission not included in the list is
|
||||||
|
# implicitly set to "none".
|
||||||
|
#
|
||||||
|
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -8,18 +17,19 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'main'
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DESTDIR: ./bin
|
DESTDIR: ./bin
|
||||||
GO_VERSION: 1.23.6
|
GO_VERSION: 1.25.8
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
validate:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 30 # guardrails timeout for the whole job
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -29,10 +39,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
-
|
-
|
||||||
name: Run
|
name: Run
|
||||||
run: |
|
run: |
|
||||||
@@ -40,23 +50,24 @@ jobs:
|
|||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 30 # guardrails timeout for the whole job
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-24.04
|
- ubuntu-24.04
|
||||||
- ubuntu-22.04
|
- ubuntu-22.04
|
||||||
|
- macOS-15-intel
|
||||||
- macOS-15
|
- macOS-15
|
||||||
- macOS-14
|
- macOS-14
|
||||||
- macOS-13
|
|
||||||
- windows-2022
|
- windows-2022
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
-
|
-
|
||||||
@@ -73,7 +84,7 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: GPG conf
|
name: GPG conf
|
||||||
if: ${{ !startsWith(matrix.os, 'windows-') }}
|
if: ${{ !startsWith(matrix.os, 'windows-') }}
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
id: gpg
|
id: gpg
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
@@ -90,7 +101,7 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Import GPG key
|
name: Import GPG key
|
||||||
if: ${{ !startsWith(matrix.os, 'windows-') }}
|
if: ${{ !startsWith(matrix.os, 'windows-') }}
|
||||||
uses: crazy-max/ghaction-import-gpg@v6
|
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0
|
||||||
with:
|
with:
|
||||||
gpg_private_key: ${{ steps.gpg.outputs.key }}
|
gpg_private_key: ${{ steps.gpg.outputs.key }}
|
||||||
passphrase: ${{ steps.gpg.outputs.passphrase }}
|
passphrase: ${{ steps.gpg.outputs.passphrase }}
|
||||||
@@ -108,20 +119,21 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v5
|
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
||||||
with:
|
with:
|
||||||
files: ${{ env.DESTDIR }}/coverage.txt
|
files: ${{ env.DESTDIR }}/coverage.txt
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
test-sandboxed:
|
test-sandboxed:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 30 # guardrails timeout for the whole job
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@v6
|
uses: docker/bake-action@a66e1c87e2eca0503c343edf1d208c716d54b8a8 # v7.1.0
|
||||||
with:
|
with:
|
||||||
targets: test
|
targets: test
|
||||||
set: |
|
set: |
|
||||||
@@ -129,25 +141,29 @@ jobs:
|
|||||||
*.cache-to=type=gha,scope=test,mode=max
|
*.cache-to=type=gha,scope=test,mode=max
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v5
|
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
||||||
with:
|
with:
|
||||||
files: ${{ env.DESTDIR }}//coverage.txt
|
files: ${{ env.DESTDIR }}//coverage.txt
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 30 # guardrails timeout for the whole job
|
||||||
|
permissions:
|
||||||
|
# required to create GitHub release
|
||||||
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
run: |
|
run: |
|
||||||
@@ -165,7 +181,7 @@ jobs:
|
|||||||
find ${{ env.DESTDIR }} -type f -exec file -e ascii -e text -- {} +
|
find ${{ env.DESTDIR }} -type f -exec file -e ascii -e text -- {} +
|
||||||
-
|
-
|
||||||
name: Upload artifacts
|
name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||||
with:
|
with:
|
||||||
name: docker-credential-helpers
|
name: docker-credential-helpers
|
||||||
path: ${{ env.DESTDIR }}/*
|
path: ${{ env.DESTDIR }}/*
|
||||||
@@ -173,7 +189,7 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: GitHub Release
|
name: GitHub Release
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
|
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
@@ -181,11 +197,12 @@ jobs:
|
|||||||
files: ${{ env.DESTDIR }}/*
|
files: ${{ env.DESTDIR }}/*
|
||||||
|
|
||||||
build-deb:
|
build-deb:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 30 # guardrails timeout for the whole job
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
|
|||||||
+11
-19
@@ -1,31 +1,23 @@
|
|||||||
|
version: "2"
|
||||||
run:
|
run:
|
||||||
timeout: 10m
|
|
||||||
modules-download-mode: vendor
|
modules-download-mode: vendor
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
|
default: none
|
||||||
enable:
|
enable:
|
||||||
- gofmt
|
|
||||||
- govet
|
- govet
|
||||||
- depguard
|
|
||||||
- goimports
|
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- misspell
|
- misspell
|
||||||
- unused
|
|
||||||
- revive
|
- revive
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- typecheck
|
- unused
|
||||||
disable-all: true
|
settings:
|
||||||
|
revive:
|
||||||
linters-settings:
|
|
||||||
depguard:
|
|
||||||
rules:
|
rules:
|
||||||
main:
|
- name: package-comments # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#package-comments
|
||||||
deny:
|
disabled: true
|
||||||
- pkg: "io/ioutil"
|
|
||||||
desc: The io/ioutil package has been deprecated. See https://go.dev/doc/go1.16#ioutil
|
|
||||||
|
|
||||||
issues:
|
formatters:
|
||||||
exclude-rules:
|
enable:
|
||||||
- linters:
|
- gofmt
|
||||||
- revive
|
- goimports
|
||||||
text: "stutters"
|
|
||||||
|
|||||||
+16
-37
@@ -1,12 +1,11 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG GO_VERSION=1.23.6
|
ARG GO_VERSION=1.25.8
|
||||||
ARG DEBIAN_VERSION=bookworm
|
ARG DEBIAN_VERSION=bookworm
|
||||||
|
|
||||||
ARG XX_VERSION=1.6.1
|
ARG XX_VERSION=1.7.0
|
||||||
ARG OSXCROSS_VERSION=11.3-r7-debian
|
ARG OSXCROSS_VERSION=11.3-r8-debian
|
||||||
ARG GOLANGCI_LINT_VERSION=v1.64.5
|
ARG GOLANGCI_LINT_VERSION=v2.8
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
ARG PACKAGE=github.com/docker/docker-credential-helpers
|
ARG PACKAGE=github.com/docker/docker-credential-helpers
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@ FROM crazymax/osxcross:${OSXCROSS_VERSION} AS osxcross
|
|||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${DEBIAN_VERSION} AS gobase
|
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${DEBIAN_VERSION} AS gobase
|
||||||
COPY --from=xx / /
|
COPY --from=xx / /
|
||||||
ARG DEBIAN_FRONTEND
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends clang dpkg-dev file git lld llvm make pkg-config rsync
|
RUN apt-get update && apt-get install -y --no-install-recommends clang dpkg-dev file git lld llvm make pkg-config rsync
|
||||||
ENV GOFLAGS="-mod=vendor"
|
ENV GOFLAGS="-mod=vendor"
|
||||||
ENV CGO_ENABLED="1"
|
ENV CGO_ENABLED="1"
|
||||||
@@ -56,7 +54,6 @@ EOT
|
|||||||
|
|
||||||
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION} AS golangci-lint
|
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION} AS golangci-lint
|
||||||
FROM gobase AS lint
|
FROM gobase AS lint
|
||||||
ARG DEBIAN_FRONTEND
|
|
||||||
RUN apt-get install -y binutils gcc libc6-dev libgcc-11-dev libsecret-1-dev pkg-config
|
RUN apt-get install -y binutils gcc libc6-dev libgcc-11-dev libsecret-1-dev pkg-config
|
||||||
RUN --mount=type=bind,target=. \
|
RUN --mount=type=bind,target=. \
|
||||||
--mount=type=cache,target=/root/.cache \
|
--mount=type=cache,target=/root/.cache \
|
||||||
@@ -65,11 +62,9 @@ RUN --mount=type=bind,target=. \
|
|||||||
|
|
||||||
FROM gobase AS base
|
FROM gobase AS base
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ARG DEBIAN_FRONTEND
|
|
||||||
RUN xx-apt-get install -y binutils gcc libc6-dev libgcc-11-dev libsecret-1-dev pkg-config
|
RUN xx-apt-get install -y binutils gcc libc6-dev libgcc-11-dev libsecret-1-dev pkg-config
|
||||||
|
|
||||||
FROM base AS test
|
FROM base AS test
|
||||||
ARG DEBIAN_FRONTEND
|
|
||||||
RUN xx-apt-get install -y dbus-x11 gnome-keyring gpg-agent gpgconf libsecret-1-dev pass
|
RUN xx-apt-get install -y dbus-x11 gnome-keyring gpg-agent gpgconf libsecret-1-dev pass
|
||||||
RUN --mount=type=bind,target=. \
|
RUN --mount=type=bind,target=. \
|
||||||
--mount=type=cache,target=/root/.cache \
|
--mount=type=cache,target=/root/.cache \
|
||||||
@@ -99,21 +94,7 @@ FROM gobase AS version
|
|||||||
RUN --mount=target=. \
|
RUN --mount=target=. \
|
||||||
echo -n "$(./hack/git-meta version)" | tee /tmp/.version ; echo -n "$(./hack/git-meta revision)" | tee /tmp/.revision
|
echo -n "$(./hack/git-meta version)" | tee /tmp/.version ; echo -n "$(./hack/git-meta revision)" | tee /tmp/.revision
|
||||||
|
|
||||||
FROM base AS build-linux
|
FROM base AS build
|
||||||
ARG PACKAGE
|
|
||||||
RUN --mount=type=bind,target=. \
|
|
||||||
--mount=type=cache,target=/root/.cache \
|
|
||||||
--mount=type=cache,target=/go/pkg/mod \
|
|
||||||
--mount=type=bind,source=/tmp/.version,target=/tmp/.version,from=version \
|
|
||||||
--mount=type=bind,source=/tmp/.revision,target=/tmp/.revision,from=version <<EOT
|
|
||||||
set -ex
|
|
||||||
xx-go --wrap
|
|
||||||
make build-pass build-secretservice PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
|
||||||
xx-verify /out/docker-credential-pass
|
|
||||||
xx-verify /out/docker-credential-secretservice
|
|
||||||
EOT
|
|
||||||
|
|
||||||
FROM base AS build-darwin
|
|
||||||
ARG PACKAGE
|
ARG PACKAGE
|
||||||
RUN --mount=type=bind,target=. \
|
RUN --mount=type=bind,target=. \
|
||||||
--mount=type=cache,target=/root/.cache \
|
--mount=type=cache,target=/root/.cache \
|
||||||
@@ -124,28 +105,26 @@ RUN --mount=type=bind,target=. \
|
|||||||
set -ex
|
set -ex
|
||||||
export MACOSX_VERSION_MIN=$(make print-MACOSX_DEPLOYMENT_TARGET)
|
export MACOSX_VERSION_MIN=$(make print-MACOSX_DEPLOYMENT_TARGET)
|
||||||
xx-go --wrap
|
xx-go --wrap
|
||||||
|
case "$(xx-info os)" in
|
||||||
|
linux)
|
||||||
|
make build-pass build-secretservice PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
||||||
|
xx-verify /out/docker-credential-pass
|
||||||
|
xx-verify /out/docker-credential-secretservice
|
||||||
|
;;
|
||||||
|
darwin)
|
||||||
go install std
|
go install std
|
||||||
make build-osxkeychain build-pass PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
make build-osxkeychain build-pass PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
||||||
xx-verify /out/docker-credential-osxkeychain
|
xx-verify /out/docker-credential-osxkeychain
|
||||||
xx-verify /out/docker-credential-pass
|
xx-verify /out/docker-credential-pass
|
||||||
EOT
|
;;
|
||||||
|
windows)
|
||||||
FROM base AS build-windows
|
|
||||||
ARG PACKAGE
|
|
||||||
RUN --mount=type=bind,target=. \
|
|
||||||
--mount=type=cache,target=/root/.cache \
|
|
||||||
--mount=type=cache,target=/go/pkg/mod \
|
|
||||||
--mount=type=bind,source=/tmp/.version,target=/tmp/.version,from=version \
|
|
||||||
--mount=type=bind,source=/tmp/.revision,target=/tmp/.revision,from=version <<EOT
|
|
||||||
set -ex
|
|
||||||
xx-go --wrap
|
|
||||||
make build-wincred PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
make build-wincred PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
||||||
mv /out/docker-credential-wincred /out/docker-credential-wincred.exe
|
mv /out/docker-credential-wincred /out/docker-credential-wincred.exe
|
||||||
xx-verify /out/docker-credential-wincred.exe
|
xx-verify /out/docker-credential-wincred.exe
|
||||||
|
;;
|
||||||
|
esac
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
FROM build-$TARGETOS AS build
|
|
||||||
|
|
||||||
FROM scratch AS binaries
|
FROM scratch AS binaries
|
||||||
COPY --from=build /out /
|
COPY --from=build /out /
|
||||||
|
|
||||||
|
|||||||
+3
-5
@@ -1,14 +1,12 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG GO_VERSION=1.23.6
|
ARG GO_VERSION=1.25.8
|
||||||
ARG DISTRO=ubuntu
|
ARG DISTRO=ubuntu
|
||||||
ARG SUITE=focal
|
ARG SUITE=jammy
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-bullseye AS golang
|
FROM golang:${GO_VERSION}-bookworm AS golang
|
||||||
|
|
||||||
FROM ${DISTRO}:${SUITE}
|
FROM ${DISTRO}:${SUITE}
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get update && apt-get install -yy debhelper dh-make libsecret-1-dev
|
RUN apt-get update && apt-get install -yy debhelper dh-make libsecret-1-dev
|
||||||
RUN mkdir -p /build
|
RUN mkdir -p /build
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ retract (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/danieljoos/wincred v1.2.2
|
github.com/danieljoos/wincred v1.2.3
|
||||||
github.com/keybase/go-keychain v0.0.1
|
github.com/keybase/go-keychain v0.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
github.com/danieljoos/wincred v1.2.2 h1:774zMFJrqaeYCK2W57BgAem/MLi6mtSE47MB6BOJ0i0=
|
github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ=
|
||||||
github.com/danieljoos/wincred v1.2.2/go.mod h1:w7w4Utbrz8lqeMbDAK0lkNJUv5sAOkFi7nd/ogr0Uh8=
|
github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU=
|
github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU=
|
||||||
@@ -8,8 +8,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
|||||||
@@ -46,6 +46,17 @@ func (h Osxkeychain) Add(creds *credentials.Credentials) error {
|
|||||||
item.SetLabel(credentials.CredsLabel)
|
item.SetLabel(credentials.CredsLabel)
|
||||||
item.SetAccount(creds.Username)
|
item.SetAccount(creds.Username)
|
||||||
item.SetData([]byte(creds.Secret))
|
item.SetData([]byte(creds.Secret))
|
||||||
|
// Prior to v0.9, the credential helper was searching for credentials with
|
||||||
|
// the "dflt" authentication type (see [1]). Since v0.9.0, Get doesn't use
|
||||||
|
// that attribute anymore, and v0.9.0 - v0.9.2 were not setting it here
|
||||||
|
// either.
|
||||||
|
//
|
||||||
|
// In order to keep compatibility with older versions, we need to store
|
||||||
|
// credentials with this attribute set. This way, credentials stored with
|
||||||
|
// newer versions can be retrieved by older versions.
|
||||||
|
//
|
||||||
|
// [1]: https://github.com/docker/docker-credential-helpers/blob/v0.8.2/osxkeychain/osxkeychain.c#L66
|
||||||
|
item.SetAuthenticationType("dflt")
|
||||||
if err := splitServer(creds.ServerURL, item); err != nil {
|
if err := splitServer(creds.ServerURL, item); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -83,10 +83,10 @@ func TestPassHelperList(t *testing.T) {
|
|||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
for server, username := range credsList {
|
for server, username := range credsList {
|
||||||
if !(strings.HasSuffix(server, "2376/v1") || strings.HasSuffix(server, "2375/v1")) {
|
if !strings.HasSuffix(server, "2376/v1") && !strings.HasSuffix(server, "2375/v1") {
|
||||||
t.Errorf("invalid url: %s", server)
|
t.Errorf("invalid url: %s", server)
|
||||||
}
|
}
|
||||||
if !(username == "foo" || username == "bar") {
|
if username != "foo" && username != "bar" {
|
||||||
t.Errorf("invalid username: %v", username)
|
t.Errorf("invalid username: %v", username)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-13
@@ -31,13 +31,13 @@ func utf16FromString(str string) []uint16 {
|
|||||||
|
|
||||||
// goBytes copies the given C byte array to a Go byte array (see `C.GoBytes`).
|
// goBytes copies the given C byte array to a Go byte array (see `C.GoBytes`).
|
||||||
// This function avoids having cgo as dependency.
|
// This function avoids having cgo as dependency.
|
||||||
func goBytes(src uintptr, len uint32) []byte {
|
func goBytes(src *byte, len uint32) []byte {
|
||||||
if src == uintptr(0) {
|
if src == nil || len == 0 {
|
||||||
return []byte{}
|
return []byte{}
|
||||||
}
|
}
|
||||||
rv := make([]byte, len)
|
rv := make([]byte, len)
|
||||||
copy(rv, *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{
|
copy(rv, *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{
|
||||||
Data: src,
|
Data: uintptr(unsafe.Pointer(src)),
|
||||||
Len: int(len),
|
Len: int(len),
|
||||||
Cap: int(len),
|
Cap: int(len),
|
||||||
})))
|
})))
|
||||||
@@ -59,7 +59,7 @@ func sysToCredential(cred *sysCREDENTIAL) (result *Credential) {
|
|||||||
result.CredentialBlob = goBytes(cred.CredentialBlob, cred.CredentialBlobSize)
|
result.CredentialBlob = goBytes(cred.CredentialBlob, cred.CredentialBlobSize)
|
||||||
result.Attributes = make([]CredentialAttribute, cred.AttributeCount)
|
result.Attributes = make([]CredentialAttribute, cred.AttributeCount)
|
||||||
attrSlice := *(*[]sysCREDENTIAL_ATTRIBUTE)(unsafe.Pointer(&reflect.SliceHeader{
|
attrSlice := *(*[]sysCREDENTIAL_ATTRIBUTE)(unsafe.Pointer(&reflect.SliceHeader{
|
||||||
Data: cred.Attributes,
|
Data: uintptr(unsafe.Pointer(cred.Attributes)),
|
||||||
Len: int(cred.AttributeCount),
|
Len: int(cred.AttributeCount),
|
||||||
Cap: int(cred.AttributeCount),
|
Cap: int(cred.AttributeCount),
|
||||||
}))
|
}))
|
||||||
@@ -85,17 +85,13 @@ func sysFromCredential(cred *Credential) (result *sysCREDENTIAL) {
|
|||||||
result.LastWritten = syscall.NsecToFiletime(cred.LastWritten.UnixNano())
|
result.LastWritten = syscall.NsecToFiletime(cred.LastWritten.UnixNano())
|
||||||
result.CredentialBlobSize = uint32(len(cred.CredentialBlob))
|
result.CredentialBlobSize = uint32(len(cred.CredentialBlob))
|
||||||
if len(cred.CredentialBlob) > 0 {
|
if len(cred.CredentialBlob) > 0 {
|
||||||
result.CredentialBlob = uintptr(unsafe.Pointer(&cred.CredentialBlob[0]))
|
result.CredentialBlob = &cred.CredentialBlob[0]
|
||||||
} else {
|
|
||||||
result.CredentialBlob = 0
|
|
||||||
}
|
}
|
||||||
result.Persist = uint32(cred.Persist)
|
result.Persist = uint32(cred.Persist)
|
||||||
result.AttributeCount = uint32(len(cred.Attributes))
|
result.AttributeCount = uint32(len(cred.Attributes))
|
||||||
attributes := make([]sysCREDENTIAL_ATTRIBUTE, len(cred.Attributes))
|
attributes := make([]sysCREDENTIAL_ATTRIBUTE, len(cred.Attributes))
|
||||||
if len(attributes) > 0 {
|
if len(attributes) > 0 {
|
||||||
result.Attributes = uintptr(unsafe.Pointer(&attributes[0]))
|
result.Attributes = &attributes[0]
|
||||||
} else {
|
|
||||||
result.Attributes = 0
|
|
||||||
}
|
}
|
||||||
for i := range cred.Attributes {
|
for i := range cred.Attributes {
|
||||||
inAttr := &cred.Attributes[i]
|
inAttr := &cred.Attributes[i]
|
||||||
@@ -104,9 +100,7 @@ func sysFromCredential(cred *Credential) (result *sysCREDENTIAL) {
|
|||||||
outAttr.Flags = 0
|
outAttr.Flags = 0
|
||||||
outAttr.ValueSize = uint32(len(inAttr.Value))
|
outAttr.ValueSize = uint32(len(inAttr.Value))
|
||||||
if len(inAttr.Value) > 0 {
|
if len(inAttr.Value) > 0 {
|
||||||
outAttr.Value = uintptr(unsafe.Pointer(&inAttr.Value[0]))
|
outAttr.Value = &inAttr.Value[0]
|
||||||
} else {
|
|
||||||
outAttr.Value = 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.TargetAlias, _ = syscall.UTF16PtrFromString(cred.TargetAlias)
|
result.TargetAlias, _ = syscall.UTF16PtrFromString(cred.TargetAlias)
|
||||||
|
|||||||
+6
-3
@@ -5,6 +5,7 @@ package wincred
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
@@ -33,10 +34,10 @@ type sysCREDENTIAL struct {
|
|||||||
Comment *uint16
|
Comment *uint16
|
||||||
LastWritten windows.Filetime
|
LastWritten windows.Filetime
|
||||||
CredentialBlobSize uint32
|
CredentialBlobSize uint32
|
||||||
CredentialBlob uintptr
|
CredentialBlob *byte
|
||||||
Persist uint32
|
Persist uint32
|
||||||
AttributeCount uint32
|
AttributeCount uint32
|
||||||
Attributes uintptr
|
Attributes *sysCREDENTIAL_ATTRIBUTE
|
||||||
TargetAlias *uint16
|
TargetAlias *uint16
|
||||||
UserName *uint16
|
UserName *uint16
|
||||||
}
|
}
|
||||||
@@ -46,7 +47,7 @@ type sysCREDENTIAL_ATTRIBUTE struct {
|
|||||||
Keyword *uint16
|
Keyword *uint16
|
||||||
Flags uint32
|
Flags uint32
|
||||||
ValueSize uint32
|
ValueSize uint32
|
||||||
Value uintptr
|
Value *byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://docs.microsoft.com/en-us/windows/desktop/api/wincred/ns-wincred-_credentialw
|
// https://docs.microsoft.com/en-us/windows/desktop/api/wincred/ns-wincred-_credentialw
|
||||||
@@ -93,6 +94,8 @@ func sysCredWrite(cred *Credential, typ sysCRED_TYPE) error {
|
|||||||
uintptr(unsafe.Pointer(ncred)),
|
uintptr(unsafe.Pointer(ncred)),
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
|
// Make sure everything reachable from ncred stays alive through the call.
|
||||||
|
runtime.KeepAlive(ncred)
|
||||||
if ret == 0 {
|
if ret == 0 {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
# github.com/danieljoos/wincred v1.2.2
|
# github.com/danieljoos/wincred v1.2.3
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/danieljoos/wincred
|
github.com/danieljoos/wincred
|
||||||
# github.com/keybase/go-keychain v0.0.1
|
# github.com/keybase/go-keychain v0.0.1
|
||||||
|
|||||||
Reference in New Issue
Block a user