Skip to content

Commit

Permalink
Merge pull request #36 from mesosphere/mh/devbox
Browse files Browse the repository at this point in the history
chore: switch to devbox
  • Loading branch information
mhrabovcin authored Sep 6, 2024
2 parents 1c43e44 + 9a07bf1 commit 231a4a7
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 506 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,35 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup asdf
uses: asdf-vm/actions/setup@v1

- name: Install Nix on self-hosted ARC runners
uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Install devbox
uses: jetify-com/[email protected]
with:
enable-cache: false
skip-nix-installation: true

- name: Granting private modules access
run: |
git config --global url."https://${{ secrets.MESOSPHERECI_USER_TOKEN }}:[email protected]/".insteadOf "https://github.com/"
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build container image
run: make container
run: devbox run -- make container
env:
GITHUB_TOKEN: ${{ secrets.MESOSPHERECI_USER_TOKEN }}
TAG: ${{ needs.set-env.outputs.RELEASE_VERSION }}

- name: Push container image
run: make push-image
run: devbox run -- make push-image
env:
TAG: ${{ needs.set-env.outputs.RELEASE_VERSION }}
3 changes: 0 additions & 3 deletions .tool-versions

This file was deleted.

38 changes: 7 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
REPO_ROOT := $(CURDIR)
GOBIN=$(shell pwd)/bin
GOPATH := $(shell go env GOPATH)
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
GOFILES=$(wildcard *.go)
Expand All @@ -9,32 +8,27 @@ IMAGE_NAME ?= mesosphere/dex-k8s-authenticator
DISTROLESS_STATIC_IMAGE ?= gcr.io/distroless/static@sha256:6706c73aae2afaa8201d63cc3dda48753c09bcd6c300762251065c0f7e602b25
TAG ?= latest
export CGO_ENABLED=0
export GO111MODULE ?= on
export GOPRIVATE ?= github.com/mesosphere

KONVOY_ASYNC_AUTH_VERSION ?= v0.2.0

all: build

.PHONY: get
get:
@go get -d .

.PHONY: konvoy-async-auth
konvoy-async-auth: install-tools
konvoy-async-auth:
@rm -rf _build/konvoy-async-auth*
@gh release download $(KONVOY_ASYNC_AUTH_VERSION) -R https://github.com/mesosphere/konvoy-async-auth -D _build/
@tar -xjvf "_build/konvoy-async-auth_$(KONVOY_ASYNC_AUTH_VERSION)_linux_amd64.tar.gz" -C html/static/downloads
@tar -xjvf "_build/konvoy-async-auth_$(KONVOY_ASYNC_AUTH_VERSION)_darwin_amd64.tar.gz" -C html/static/downloads
@tar -xjvf "_build/konvoy-async-auth_$(KONVOY_ASYNC_AUTH_VERSION)_darwin_arm64.tar.gz" -C html/static/downloads
@tar -xjvf "_build/konvoy-async-auth_$(KONVOY_ASYNC_AUTH_VERSION)_windows_amd64.tar.gz" -C html/static/downloads
@tar -xzvf "_build/konvoy-async-auth_$(KONVOY_ASYNC_AUTH_VERSION)_linux_amd64.tar.gz" -C html/static/downloads
@tar -xzvf "_build/konvoy-async-auth_$(KONVOY_ASYNC_AUTH_VERSION)_darwin_amd64.tar.gz" -C html/static/downloads
@tar -xzvf "_build/konvoy-async-auth_$(KONVOY_ASYNC_AUTH_VERSION)_darwin_arm64.tar.gz" -C html/static/downloads
@tar -xzvf "_build/konvoy-async-auth_$(KONVOY_ASYNC_AUTH_VERSION)_windows_amd64.tar.gz" -C html/static/downloads

.PHONY: build
build: get konvoy-async-auth install-tools
build: konvoy-async-auth
@echo "Building $(GOFILES) to ./bin"
@go build -o bin/$(GOOS)/$(GOARCH)/$(GONAME) $(GOFILES)

test: get install-tools
test:
@go test ./...

.PHONY: container
Expand All @@ -56,21 +50,3 @@ clean:
@go clean
rm -rf ./bin
rm -rf ./_build

define install_tool
$(if $(1), \
asdf plugin list | grep -E '^$(1)$$' &>/dev/null || asdf plugin add $(1), \
grep -Eo '^[^#]\S+' $(REPO_ROOT)/.tool-versions | xargs -I{} bash -ec 'asdf plugin list | grep -E '^{}$$' &>/dev/null || asdf plugin add {}' \
)
asdf install $1
endef

.PHONY: install-tools
install-tools: ## Install all tools
install-tools: $(info $(M) installing all tools)
$(call install_tool,)

.PHONY: install-tool.%
install-tool.%: ## Install specific tool
install-tool.%: ; $(info $(M) installing $*)
$(call install_tool,$*)
17 changes: 17 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
"packages": [
"go@latest",
"github-cli@latest"
],
"shell": {
"init_hook": [
"echo 'Welcome to devbox!' > /dev/null"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
59 changes: 59 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"lockfile_version": "1",
"packages": {
"github-cli@latest": {
"last_modified": "2023-02-24T09:01:09Z",
"resolved": "github:NixOS/nixpkgs/7d0ed7f2e5aea07ab22ccb338d27fbe347ed2f11#github-cli",
"source": "devbox-search",
"version": "2.23.0"
},
"go@latest": {
"last_modified": "2024-08-31T10:12:23Z",
"resolved": "github:NixOS/nixpkgs/5629520edecb69630a3f4d17d3d33fc96c13f6fe#go_1_23",
"source": "devbox-search",
"version": "1.23.0",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/4cijk6gwv59c84h1l9yhxzsaz93f67mz-go-1.23.0",
"default": true
}
],
"store_path": "/nix/store/4cijk6gwv59c84h1l9yhxzsaz93f67mz-go-1.23.0"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/mhwsyzk9v43q67ic34c02sxnsnbj7qbh-go-1.23.0",
"default": true
}
],
"store_path": "/nix/store/mhwsyzk9v43q67ic34c02sxnsnbj7qbh-go-1.23.0"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/vbcqda38ha9gqsbwjw4q0swpwlvmnb1i-go-1.23.0",
"default": true
}
],
"store_path": "/nix/store/vbcqda38ha9gqsbwjw4q0swpwlvmnb1i-go-1.23.0"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/h5wkf711ql98c59n7yxa146jbjf9vrj5-go-1.23.0",
"default": true
}
],
"store_path": "/nix/store/h5wkf711ql98c59n7yxa146jbjf9vrj5-go-1.23.0"
}
}
}
}
}
48 changes: 47 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/mesosphere/dex-k8s-authenticator

go 1.13
go 1.23

require (
github.com/coreos/go-oidc v2.2.1+incompatible
Expand All @@ -15,3 +15,49 @@ require (
k8s.io/client-go v0.28.1
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/net v0.13.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/square/go-jose.v2 v2.4.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit 231a4a7

Please sign in to comment.