mirror of
https://github.com/int128/kubelogin.git
synced 2026-02-27 23:43:49 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61555d8ee2 | ||
|
|
f22f6ee483 | ||
|
|
c2cbc47438 | ||
|
|
765d97542c |
9
.github/renovate.json5
vendored
9
.github/renovate.json5
vendored
@@ -2,9 +2,10 @@
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"github>int128/renovate-base",
|
||||
"github>int128/go-renovate-config",
|
||||
"github>int128/go-renovate-config:github-actions",
|
||||
"github>int128/go-renovate-config:kubernetes",
|
||||
"github>int128/go-renovate-config:kustomization-github-releases",
|
||||
"github>int128/go-renovate-config#v1.6.0",
|
||||
"github>int128/go-renovate-config:go-directive#v1.6.0",
|
||||
"github>int128/go-renovate-config:github-actions#v1.6.0",
|
||||
"github>int128/go-renovate-config:kubernetes#v1.6.0",
|
||||
"github>int128/go-renovate-config:kustomization-github-releases#v1.6.0",
|
||||
],
|
||||
}
|
||||
|
||||
32
.github/workflows/go.yaml
vendored
32
.github/workflows/go.yaml
vendored
@@ -7,6 +7,8 @@ on:
|
||||
paths:
|
||||
- .github/workflows/go.yaml
|
||||
- pkg/**
|
||||
- integration_test/**
|
||||
- mocks/**
|
||||
- tools/**
|
||||
- go.*
|
||||
tags:
|
||||
@@ -17,14 +19,17 @@ on:
|
||||
paths:
|
||||
- .github/workflows/go.yaml
|
||||
- pkg/**
|
||||
- integration_test/**
|
||||
- mocks/**
|
||||
- tools/**
|
||||
- go.*
|
||||
|
||||
jobs:
|
||||
check:
|
||||
uses: int128/go-workflows/.github/workflows/check.yaml@v0.3.0
|
||||
uses: int128/go-workflows/.github/workflows/check.yaml@v0.4.0
|
||||
with:
|
||||
go-version: 1.23.1
|
||||
go-version-file: go.mod
|
||||
cache-dependency-path: go.sum
|
||||
golangci-lint-version: v1.61.0
|
||||
|
||||
test:
|
||||
@@ -34,8 +39,27 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.23.1
|
||||
- run: go test -v -race ./...
|
||||
go-version-file: go.mod
|
||||
cache-dependency-path: go.sum
|
||||
- run: go test -v -race ./pkg/...
|
||||
|
||||
integration-test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache-dependency-path: go.sum
|
||||
- run: go test -v -race ./integration_test/...
|
||||
|
||||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
3
.github/workflows/release.yaml
vendored
3
.github/workflows/release.yaml
vendored
@@ -57,7 +57,8 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.23.1
|
||||
go-version-file: go.mod
|
||||
cache-dependency-path: go.sum
|
||||
- run: go build -ldflags '-X main.version=${{ github.ref_name }}'
|
||||
- uses: int128/go-release-action@v2
|
||||
with:
|
||||
|
||||
3
.github/workflows/system-test.yaml
vendored
3
.github/workflows/system-test.yaml
vendored
@@ -25,7 +25,8 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.23.1
|
||||
go-version-file: go.mod
|
||||
cache-dependency-path: go.sum
|
||||
|
||||
# for certutil
|
||||
# https://packages.ubuntu.com/xenial/libnss3-tools
|
||||
|
||||
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
||||
module github.com/int128/kubelogin
|
||||
|
||||
go 1.22.2
|
||||
go 1.23.1
|
||||
|
||||
require (
|
||||
github.com/chromedp/chromedp v0.10.0
|
||||
|
||||
@@ -83,20 +83,22 @@ func (r *Repository) Save(dir string, key tokencache.Key, tokenSet oidc.TokenSet
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Repository) Lock(dir string, key tokencache.Key) (io.Closer, error) {
|
||||
if err := os.MkdirAll(dir, 0700); err != nil {
|
||||
return nil, fmt.Errorf("could not create directory %s: %w", dir, err)
|
||||
func (r *Repository) Lock(tokenCacheDir string, key tokencache.Key) (io.Closer, error) {
|
||||
if err := os.MkdirAll(tokenCacheDir, 0700); err != nil {
|
||||
return nil, fmt.Errorf("could not create directory %s: %w", tokenCacheDir, err)
|
||||
}
|
||||
filename, err := computeFilename(key)
|
||||
keyDigest, err := computeFilename(key)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not compute the key: %w", err)
|
||||
}
|
||||
p := filepath.Join(dir, filename)
|
||||
f := flock.New(p)
|
||||
if err := f.Lock(); err != nil {
|
||||
return nil, fmt.Errorf("could not lock the cache file %s: %w", p, err)
|
||||
// Do not lock the token cache file.
|
||||
// https://github.com/int128/kubelogin/issues/1144
|
||||
lockFilepath := filepath.Join(tokenCacheDir, keyDigest+".lock")
|
||||
lockFile := flock.New(lockFilepath)
|
||||
if err := lockFile.Lock(); err != nil {
|
||||
return nil, fmt.Errorf("could not lock the cache file %s: %w", lockFilepath, err)
|
||||
}
|
||||
return f, nil
|
||||
return lockFile, nil
|
||||
}
|
||||
|
||||
func computeFilename(key tokencache.Key) (string, error) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/int128/kubelogin/tools
|
||||
|
||||
go 1.22.5
|
||||
go 1.23.1
|
||||
|
||||
require (
|
||||
github.com/google/wire v0.6.0
|
||||
|
||||
Reference in New Issue
Block a user