Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support upstreams secured by basic auth #20

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
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
25 changes: 13 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "monthly"
labels:
- "area/dependencies"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
labels:
- "area/dependencies"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "monthly"
labels:
- "area/dependencies"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
labels:
- "area/dependencies"
21 changes: 11 additions & 10 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
area/dependencies:
- "Dockerfile"
- "go.mod"
- "go.sum"
- "Dockerfile"
- "go.mod"
- "go.sum"
area/tooling:
- ".github/**/*"
- "Dockerfile"
- ".github/**/*"
- "Dockerfile"
area/docs:
- "CODE-OF-CONDUCT.md"
- "CONTRIBUTING.md"
- "DCO"
- "LICENSE"
- "README.md"
- "CODE-OF-CONDUCT.md"
- "CONTRIBUTING.md"
- "DCO"
- "LICENSE"
- "README.md"
74 changes: 39 additions & 35 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,54 @@
---
name: "Build & Test"
on:
push:
branches:
- "!dependabot/*"
- "*"
- "!dependabot/*"
- "*"
pull_request:
branches:
- "*"
- "*"
jobs:
lint:
name: "Lint"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.16"
- name: "Go Mod Tidy"
run: |
GO_MOD_OUPUT="$(go mod tidy -v 2>&1)"
if [[ $GO_MOD_OUPUT == *"unused"* ]]; then
echo "${GO_MOD_OUPUT}"
exit 1
fi
- name: "Formatting (gofumpt)"
run: |
go install mvdan.cc/gofumpt/gofumports@latest
GOFUMPT_OUTPUT="$(gofumports -d .)"
if [ -n "$GOFUMPT_OUTPUT" ]; then
echo "All the following files are not correctly formatted"
echo "${GOFUMPT_OUTPUT}"
exit 1
fi
- name: "Linting (revive)"
run: |
go install github.com/mgechev/revive@latest
revive ./...
- uses: "actions/setup-go@v2"
with:
go-version: "^1.16"
- name: "Install linting tools"
run: |
# This is done before checking out, as to not modify go.mod
go install mvdan.cc/gofumpt/[email protected]
- uses: "actions/checkout@v2"
- uses: "bewuethr/[email protected]"
with:
config-file: ".yamllint"
- name: "Go Mod Tidy"
run: "go mod tidy && bash -c '[ $(git status --porcelain | tee /dev/fd/2 | wc -c) -eq 0 ]'"
- name: "Formatting (gofumpt)"
run: |
GOFUMPT_OUTPUT="$(find . -iname '*.go' -type f | xargs gofumports -d)"
if [ -n "$GOFUMPT_OUTPUT" ]; then
echo "All the following files are not correctly formatted"
echo "${GOFUMPT_OUTPUT}"
exit 1
fi
- uses: "golangci/golangci-lint-action@v2"
with:
version: "v1.43"
skip-go-installation: true
skip-pkg-cache: true
skip-build-cache: false
test:
name: "Test"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.16"
- name: "Build"
run: "go build ."
- name: "Test"
run: "go test ./..."
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.16"
- name: "Build"
run: "go build ."
- name: "Test"
run: "go test ./..."
2 changes: 1 addition & 1 deletion .github/workflows/cla.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
path-to-signatures: "v1/signatures.json"
path-to-document: "https://github.com/authzed/cla/blob/main/v1/icla.md"
branch: "main"
allowlist: "authzedbot,dependabot-bot"
allowlist: "authzedbot,dependabot[bot]"
11 changes: 6 additions & 5 deletions .github/workflows/labeler.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
name: "Pull Request Labeler"
on:
- "pull_request_target"
- "pull_request_target"
jobs:
triage:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/labeler@v3"
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
- uses: "actions/labeler@v3"
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
39 changes: 20 additions & 19 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
---
name: "Release"
on:
push:
tags:
- '*'
- '*'
jobs:
docker:
name: "Publish Container Image"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "docker/setup-qemu-action@v1"
- uses: "docker/setup-buildx-action@v1"
with:
driver-opts: "image=moby/buildkit:master"
- uses: "docker/login-action@v1"
with:
registry: "quay.io"
username: ${{ secrets.QUAYIO_USER }}
password: ${{ secrets.QUAYIO_PASSWORD }}
- uses: "battila7/get-version-action@v2"
id: "get_version"
- uses: "docker/build-push-action@v2"
with:
push: true
tags: |
quay.io/authzed/prom-authzed-proxy:latest
quay.io/authzed/prom-authzed-proxy:${{ steps.get_version.outputs.version }}
- uses: "actions/checkout@v2"
- uses: "docker/setup-qemu-action@v1"
- uses: "docker/setup-buildx-action@v1"
with:
driver-opts: "image=moby/buildkit:master"
- uses: "docker/login-action@v1"
with:
registry: "quay.io"
username: "${{ secrets.QUAYIO_USER }}"
password: "${{ secrets.QUAYIO_PASSWORD }}"
- uses: "battila7/get-version-action@v2"
id: "get_version"
- uses: "docker/build-push-action@v2"
with:
push: true
tags: |
quay.io/authzed/prom-authzed-proxy:latest
quay.io/authzed/prom-authzed-proxy:${{ steps.get_version.outputs.version }}
22 changes: 22 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
output:
sort-results: true
linters-settings:
goimports:
local-prefixes: "github.com/authzed/prom-authzed-proxy"
linters:
enable:
- "deadcode"
- "errcheck"
- "gofumpt"
- "goimports"
- "gosimple"
- "govet"
- "ineffassign"
- "revive"
- "rowserrcheck"
- "staticcheck"
- "structcheck"
- "typecheck"
- "unused"
- "varcheck"
10 changes: 10 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# vim: ft=yaml
---
yaml-files:
- "*.yaml"
- "*.yml"
- ".yamllint"
extends: "default"
rules:
quoted-strings: "enable"
line-length: "disable"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ RUN go build .

FROM alpine:3.14.2
COPY --from=build /go/src/prom-authzed-proxy/prom-authzed-proxy /usr/local/bin/
CMD ["prom-authzed-proxy"]
ENTRYPOINT ["prom-authzed-proxy"]
12 changes: 9 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ require (
github.com/authzed/authzed-go v0.2.0
github.com/authzed/grpcutil v0.0.0-20210913124023-cad23ae5a9e8
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
github.com/jzelinskie/cobrautil v0.0.2
github.com/jzelinskie/cobrautil v0.0.7
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/opencontainers/runc v1.0.1 // indirect
github.com/ory/dockertest v3.3.5+incompatible
github.com/prometheus-community/prom-label-proxy v0.4.0
github.com/prometheus/client_golang v1.11.0
github.com/rs/cors v1.8.0
github.com/rs/zerolog v1.25.0
github.com/rs/zerolog v1.26.0
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.9.0 // indirect
github.com/stretchr/testify v1.7.0
google.golang.org/grpc v1.40.0
go.opentelemetry.io/otel/exporters/jaeger v1.1.0 // indirect
golang.org/x/net v0.0.0-20211111160137-58aab5ef257a // indirect
golang.org/x/sys v0.0.0-20211110154304-99a53858aa08 // indirect
google.golang.org/genproto v0.0.0-20211111162719-482062a4217b // indirect
google.golang.org/grpc v1.42.0
)
Loading