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
137 changes: 136 additions & 1 deletion .github/workflows/callable-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
exit 1
fi

go-build:
kerberos:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -104,3 +104,138 @@ jobs:

- name: Build
run: make build

echo:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Golang
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: false

- name: Compute build cache key
id: build-cache-key
run: |
checksum=$(
{
cat go.mod
[ -f go.sum ] && cat go.sum
cat Makefile
find . -type f -name '*.go' \
-not -path './test/suites/*' \
-not -path './tools/*' \
-print0 | sort -z | xargs -0 cat
} | md5sum | awk '{print $1}'
)
echo "checksum=$checksum" >> "$GITHUB_OUTPUT"

- name: Cache Go module cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: echo-go-mod-${{ runner.os }}-${{ hashFiles('go.sum') }}

- name: Cache Go build cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/go-build
key: echo-go-build-${{ runner.os }}-${{ steps.build-cache-key.outputs.checksum }}
restore-keys: |
echo-go-build-${{ runner.os }}-

- name: Build
run: make echo/build

connector:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Golang
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: false

- name: Compute build cache key
id: build-cache-key
run: |
checksum=$(
{
cat go.mod
[ -f go.sum ] && cat go.sum
cat Makefile
find . -type f -name '*.go' \
-not -path './test/suites/*' \
-not -path './tools/*' \
-print0 | sort -z | xargs -0 cat
} | md5sum | awk '{print $1}'
)
echo "checksum=$checksum" >> "$GITHUB_OUTPUT"

- name: Cache Go module cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: connector-go-mod-${{ runner.os }}-${{ hashFiles('go.sum') }}

- name: Cache Go build cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/go-build
key: connector-go-build-${{ runner.os }}-${{ steps.build-cache-key.outputs.checksum }}
restore-keys: |
connector-go-build-${{ runner.os }}-

- name: Build
run: make connector/build

krbctl:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Golang
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: false

- name: Compute build cache key
id: build-cache-key
run: |
checksum=$(
{
cat go.mod
[ -f go.sum ] && cat go.sum
cat Makefile
find . -type f -name '*.go' \
-not -path './test/suites/*' \
-not -path './tools/*' \
-print0 | sort -z | xargs -0 cat
} | md5sum | awk '{print $1}'
)
echo "checksum=$checksum" >> "$GITHUB_OUTPUT"

- name: Cache Go module cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: krbctl-go-mod-${{ runner.os }}-${{ hashFiles('go.sum') }}

- name: Cache Go build cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/go-build
key: krbctl-go-build-${{ runner.os }}-${{ steps.build-cache-key.outputs.checksum }}
restore-keys: |
krbctl-go-build-${{ runner.os }}-

- name: Build
run: make krbctl/build
71 changes: 71 additions & 0 deletions .github/workflows/release-krbctl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Release krbctl

on:
release:
types:
- published

concurrency:
group: release-cli-${{ github.ref_name }}
cancel-in-progress: false

permissions:
contents: read

jobs:
release-assets:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Golang
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: false

- name: Compute build cache key
id: build-cache-key
run: |
checksum=$(
{
cat go.mod
[ -f go.sum ] && cat go.sum
cat Makefile
find . -type f -name '*.go' \
-not -path './test/suites/*' \
-not -path './tools/*' \
-print0 | sort -z | xargs -0 cat
} | md5sum | awk '{print $1}'
)
echo "checksum=$checksum" >> "$GITHUB_OUTPUT"

- name: Cache Go module cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: cli-release-go-mod-${{ runner.os }}-${{ hashFiles('go.sum') }}

- name: Cache Go build cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/go-build
key: krbctl-release-go-build-${{ runner.os }}-${{ steps.build-cache-key.outputs.checksum }}
restore-keys: |
krbctl-release-go-build-${{ runner.os }}-

- name: Build release artifacts
run: make krbctl/release VERSION=${{ github.ref_name }}

- name: Upload artifacts to release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload "${{ github.ref_name }}" \
build/release/*.tar.gz \
build/release/*.zip \
build/release/checksums.txt \
--clobber
50 changes: 50 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ docker/network/rm:

echo/build:
$(call cecho,Building Echo binary...,$(BOLD_YELLOW))
@mkdir -p build
@CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o build/echo ./cmd/echo

echo/docker/build:
Expand Down Expand Up @@ -310,6 +311,55 @@ connector/docker/stop:
connector/docker/rm:
@docker rm connector || true

# krbctl version injection: the version string is compiled into the binary via
# ldflags, since krbctl is a distributed CLI and end users won't set env vars.
KRBCTL_PKG := github.com/trebent/kerberos/cmd/krbctl/cmd
KRBCTL_LDFLAGS := -s -w -X $(KRBCTL_PKG).version=$(VERSION)

# krbctl release build matrix (GOOS/GOARCH pairs).
KRBCTL_PLATFORMS := \
linux/amd64 \
linux/arm64 \
darwin/amd64 \
darwin/arm64 \
windows/amd64 \
windows/arm64

krbctl/build:
$(call cecho,Building krbctl binary...,$(BOLD_YELLOW))
@mkdir -p build
@CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="$(KRBCTL_LDFLAGS)" -o build/krbctl ./cmd/krbctl

krbctl/install:
$(call cecho,Installing krbctl binary to $(GOBIN)...,$(BOLD_YELLOW))
@CGO_ENABLED=0 GOOS=linux go install -trimpath -ldflags="$(KRBCTL_LDFLAGS)" ./cmd/krbctl
Comment thread
maansaake marked this conversation as resolved.

krbctl/release:
$(call cecho,Building krbctl release artifacts for version $(VERSION)...,$(BOLD_YELLOW))
@rm -rf build/release
@mkdir -p build/release
@for platform in $(KRBCTL_PLATFORMS); do \
os=$${platform%/*}; \
arch=$${platform#*/}; \
name=krbctl_$(VERSION)_$${os}_$${arch}; \
bin=krbctl; \
if [ "$${os}" = "windows" ]; then bin=krbctl.exe; fi; \
printf "${BOLD_YELLOW} -> $${os}/$${arch}${RESET}\n"; \
mkdir -p build/release/$${name}; \
CGO_ENABLED=0 GOOS=$${os} GOARCH=$${arch} \
go build -trimpath -ldflags="$(KRBCTL_LDFLAGS)" \
-o build/release/$${name}/$${bin} ./cmd/krbctl || exit 1; \
if [ "$${os}" = "windows" ]; then \
(cd build/release && zip -q -r $${name}.zip $${name}) || exit 1; \
else \
tar -czf build/release/$${name}.tar.gz -C build/release $${name} || exit 1; \
fi; \
rm -rf build/release/$${name}; \
done
$(call cecho,Generating checksums...,$(BOLD_YELLOW))
@cd build/release && sha256sum *.tar.gz *.zip > checksums.txt
$(call cecho,krbctl release artifacts written to build/release.,$(BOLD_GREEN))

install/deps:
go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.6.0

Expand Down
2 changes: 1 addition & 1 deletion cmd/admin-connector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func main() {
WithName("admin-connector"),
)

zerologr.Info("Starting admin connector", "port", port.Value())
zerologr.Info("Starting admin connector", "port", port.Value(), "target", target.Value())

signalCtx, signalCancel := signal.NotifyContext(
context.Background(),
Expand Down
Loading
Loading