Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11969e8f46 | |||
| 788c8712ba | |||
| 6a81ba8a5c | |||
| 98d3388884 | |||
| 61c18ea964 | |||
| 8e324c0bd2 | |||
| b12edf764f |
27
.gitea/workflows/goreleaser.yaml
Normal file
27
.gitea/workflows/goreleaser.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: stable
|
||||||
|
- name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v6
|
||||||
|
with:
|
||||||
|
distribution: goreleaser
|
||||||
|
version: "~> v2"
|
||||||
|
args: "release --clean"
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
ward
|
ward
|
||||||
|
dist/
|
||||||
|
|||||||
13
.goreleaser.yaml
Normal file
13
.goreleaser.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
archives:
|
||||||
|
- formats: binary
|
||||||
|
|
||||||
|
gitea_urls:
|
||||||
|
api: https://git.shee.sh/api/v1
|
||||||
|
download: https://git.shee.sh
|
||||||
@@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/jcmturner/gokrb5/v8/spnego"
|
"github.com/jcmturner/gokrb5/v8/spnego"
|
||||||
)
|
)
|
||||||
|
|
||||||
func credFetch(server, username string, noKerberos bool, logf func(string, ...interface{})) (*ExecCredential, error) {
|
func credFetch(server, username string, noKerberos bool, logf func(string, ...any)) (*ExecCredential, error) {
|
||||||
url := strings.TrimRight(server, "/") + "/credential"
|
url := strings.TrimRight(server, "/") + "/credential"
|
||||||
|
|
||||||
// ── Kerberos SPNEGO ───────────────────────────────────────────────────────
|
// ── Kerberos SPNEGO ───────────────────────────────────────────────────────
|
||||||
@@ -58,7 +58,7 @@ func credFetch(server, username string, noKerberos bool, logf func(string, ...in
|
|||||||
return credParse(body)
|
return credParse(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
func credFetchKerberos(url string, logf func(string, ...interface{})) ([]byte, error) {
|
func credFetchKerberos(url string, logf func(string, ...any)) ([]byte, error) {
|
||||||
krb5cfgPath := krb5ConfigPath()
|
krb5cfgPath := krb5ConfigPath()
|
||||||
logf("Kerberos: loading config from %s", krb5cfgPath)
|
logf("Kerberos: loading config from %s", krb5cfgPath)
|
||||||
krb5cfg, err := config.Load(krb5cfgPath)
|
krb5cfg, err := config.Load(krb5cfgPath)
|
||||||
@@ -104,7 +104,7 @@ func credFetchKerberos(url string, logf func(string, ...interface{})) ([]byte, e
|
|||||||
return body, nil
|
return body, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func credFetchBasic(url, username, password string, logf func(string, ...interface{})) ([]byte, error) {
|
func credFetchBasic(url, username, password string, logf func(string, ...any)) ([]byte, error) {
|
||||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("building request: %w", err)
|
return nil, fmt.Errorf("building request: %w", err)
|
||||||
@@ -166,7 +166,7 @@ func credCacheFile(serverURL string) string {
|
|||||||
return filepath.Join(credCacheDir(), fmt.Sprintf("%x.json", h))
|
return filepath.Join(credCacheDir(), fmt.Sprintf("%x.json", h))
|
||||||
}
|
}
|
||||||
|
|
||||||
func credReadCache(serverURL string, logf func(string, ...interface{})) (*ExecCredential, bool) {
|
func credReadCache(serverURL string, logf func(string, ...any)) (*ExecCredential, bool) {
|
||||||
path := credCacheFile(serverURL)
|
path := credCacheFile(serverURL)
|
||||||
logf("cache: checking %s", path)
|
logf("cache: checking %s", path)
|
||||||
|
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -264,7 +264,7 @@ Debug output goes to stderr (kubectl surfaces this to the terminal):
|
|||||||
server += ":8443"
|
server += ":8443"
|
||||||
}
|
}
|
||||||
|
|
||||||
logf := func(format string, a ...interface{}) {
|
logf := func(format string, a ...any) {
|
||||||
if debugFlag {
|
if debugFlag {
|
||||||
fmt.Fprintf(os.Stderr, "[ward] "+format+"\n", a...)
|
fmt.Fprintf(os.Stderr, "[ward] "+format+"\n", a...)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user