mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
@@ -11,10 +11,71 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
DESTDIR: ./bin
|
DESTDIR: ./bin
|
||||||
|
GO_VERSION: 1.16.7
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-20.04
|
||||||
|
- macOS-11
|
||||||
|
- windows-2022
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
cache: true
|
||||||
|
-
|
||||||
|
name: Install deps
|
||||||
|
if: ${{ matrix.os == 'ubuntu-20.04' }}
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y dbus-x11 gnome-keyring libsecret-1-dev pass
|
||||||
|
-
|
||||||
|
name: Test
|
||||||
|
run: |
|
||||||
|
go test -short -v -coverprofile=./coverage.txt -covermode=atomic ./...
|
||||||
|
go tool cover -func=./coverage.txt
|
||||||
|
shell: bash
|
||||||
|
-
|
||||||
|
name: Upload coverage
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
file: ./coverage.txt
|
||||||
|
|
||||||
|
test-sandboxed:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
-
|
||||||
|
name: Test
|
||||||
|
uses: docker/bake-action@v2
|
||||||
|
with:
|
||||||
|
targets: test
|
||||||
|
set: |
|
||||||
|
*.cache-from=type=gha,scope=test
|
||||||
|
*.cache-to=type=gha,scope=test,mode=max
|
||||||
|
-
|
||||||
|
name: Upload coverage
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
file: ${{ env.DESTDIR }}//coverage.txt
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
@@ -30,6 +91,9 @@ jobs:
|
|||||||
uses: docker/bake-action@v2
|
uses: docker/bake-action@v2
|
||||||
with:
|
with:
|
||||||
targets: binaries
|
targets: binaries
|
||||||
|
set: |
|
||||||
|
*.cache-from=type=gha,scope=build
|
||||||
|
*.cache-to=type=gha,scope=build,mode=max
|
||||||
-
|
-
|
||||||
name: Move artifacts
|
name: Move artifacts
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
+12
@@ -30,6 +30,18 @@ FROM gobase AS base
|
|||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
RUN xx-apk add musl-dev gcc libsecret-dev pass
|
RUN xx-apk add musl-dev gcc libsecret-dev pass
|
||||||
|
|
||||||
|
FROM base AS test
|
||||||
|
RUN --mount=type=bind,target=. \
|
||||||
|
--mount=type=cache,target=/root/.cache \
|
||||||
|
--mount=type=cache,target=/go/pkg/mod <<EOT
|
||||||
|
set -e
|
||||||
|
xx-go test -short -v -coverprofile=/tmp/coverage.txt -covermode=atomic ./...
|
||||||
|
xx-go tool cover -func=/tmp/coverage.txt
|
||||||
|
EOT
|
||||||
|
|
||||||
|
FROM scratch AS test-coverage
|
||||||
|
COPY --from=test /tmp/coverage.txt /coverage.txt
|
||||||
|
|
||||||
FROM base AS build-linux
|
FROM base AS build-linux
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
[](https://github.com/docker/docker-credential-helpers/releases/latest)
|
||||||
|
[](https://pkg.go.dev/github.com/docker/docker-credential-helpers)
|
||||||
|
[](https://github.com/docker/docker-credential-helpers/actions?query=workflow%3Abuild)
|
||||||
|
[](https://codecov.io/gh/docker/docker-credential-helpers)
|
||||||
|
[](https://goreportcard.com/report/github.com/docker/docker-credential-helpers)
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
docker-credential-helpers is a suite of programs to use native stores to keep Docker credentials safe.
|
docker-credential-helpers is a suite of programs to use native stores to keep Docker credentials safe.
|
||||||
@@ -6,9 +12,21 @@ docker-credential-helpers is a suite of programs to use native stores to keep Do
|
|||||||
|
|
||||||
Go to the [Releases](https://github.com/docker/docker-credential-helpers/releases) page and download the binary that works better for you. Put that binary in your `$PATH`, so Docker can find it.
|
Go to the [Releases](https://github.com/docker/docker-credential-helpers/releases) page and download the binary that works better for you. Put that binary in your `$PATH`, so Docker can find it.
|
||||||
|
|
||||||
### Building from scratch
|
## Building
|
||||||
|
|
||||||
The programs in this repository are written with the Go programming language. These instructions assume that you have previous knowledge about the language and you have it installed in your machine.
|
You can build the credential helpers using Docker:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# create builder
|
||||||
|
$ docker buildx create --use
|
||||||
|
# build credential helpers from remote repository and output to ./bin/build
|
||||||
|
$ docker buildx bake "https://github.com/docker/docker-credential-helpers.git"
|
||||||
|
# or from local source
|
||||||
|
$ git clone https://github.com/docker/docker-credential-helpers.git
|
||||||
|
$ docker buildx bake
|
||||||
|
```
|
||||||
|
|
||||||
|
Or if the toolchain is already installed on your machine:
|
||||||
|
|
||||||
1 - Download the source and put it in your `$GOPATH` with `go get`.
|
1 - Download the source and put it in your `$GOPATH` with `go get`.
|
||||||
|
|
||||||
|
|||||||
+14
-2
@@ -1,8 +1,14 @@
|
|||||||
variable "GO_VERSION" {
|
variable "GO_VERSION" {
|
||||||
default = "1.16.7"
|
default = "1.16.7"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Defines the output folder
|
||||||
variable "DESTDIR" {
|
variable "DESTDIR" {
|
||||||
default = "./bin"
|
default = ""
|
||||||
|
}
|
||||||
|
function "bindir" {
|
||||||
|
params = [defaultdir]
|
||||||
|
result = DESTDIR != "" ? DESTDIR : "./bin/${defaultdir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
target "_common" {
|
target "_common" {
|
||||||
@@ -15,10 +21,16 @@ group "default" {
|
|||||||
targets = ["binaries"]
|
targets = ["binaries"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target "test" {
|
||||||
|
inherits = ["_common"]
|
||||||
|
target = "test-coverage"
|
||||||
|
output = [bindir("coverage")]
|
||||||
|
}
|
||||||
|
|
||||||
target "binaries" {
|
target "binaries" {
|
||||||
inherits = ["_common"]
|
inherits = ["_common"]
|
||||||
target = "binaries"
|
target = "binaries"
|
||||||
output = [DESTDIR]
|
output = [bindir("build")]
|
||||||
platforms = [
|
platforms = [
|
||||||
"darwin/amd64",
|
"darwin/amd64",
|
||||||
"darwin/arm64",
|
"darwin/arm64",
|
||||||
|
|||||||
Reference in New Issue
Block a user