Skip to content

Commit

Permalink
http debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
arttor committed Jun 5, 2024
1 parent cc3575b commit 363c257
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 103 deletions.
54 changes: 27 additions & 27 deletions .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: E2E tests
on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- ".github/**"
- "**.go"
- "**/config.yaml"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Fmt
run: go fmt ./...
- name: Vet
run: go vet ./...
- name: Test
run: go test ./...
# name: E2E tests
# on:
# push:
# branches:
# - main
# pull_request:
# branches:
# - main
# paths:
# - ".github/**"
# - "**.go"
# - "**/config.yaml"
# jobs:
# test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Go
# uses: actions/setup-go@v4
# with:
# go-version: "1.21"
# - name: Fmt
# run: go fmt ./...
# - name: Vet
# run: go vet ./...
# - name: Test
# run: go test ./...
149 changes: 74 additions & 75 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Release Artifacts
on:
push:
tags:
- '*'
pull_request:
branches:
- main
env:
REGISTRY: harbor.clyso.com
jobs:
Expand All @@ -11,9 +11,9 @@ jobs:
strategy:
matrix:
service:
- worker
# - worker
- proxy
- agent
# - agent
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -34,78 +34,77 @@ jobs:
push: true
tags: |
${{ env.REGISTRY }}/chorus/${{ matrix.service }}:${{ github.ref_name }}
${{ env.REGISTRY }}/chorus/${{ matrix.service }}:latest
build-args: |
GIT_TAG=${{ github.ref_name }}
GIT_COMMIT=${{ github.sha }}
SERVICE=${{ matrix.service }}
# publish helm chart
helm:
needs: docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: read chart version
id: chartVer
uses: mikefarah/[email protected]
with:
cmd: yq '.version' deploy/chorus/Chart.yaml
- name: Install helm
uses: azure/[email protected]
- name: Publish chart
run: |
echo "${{ steps.chartVer.outputs.result }}"
helm registry login -u '${{ secrets.DOCKER_USER }}' -p ${{ secrets.DOCKER_PASSWORD }} ${{ env.REGISTRY }}
helm package ./deploy/chorus --app-version=${{ github.ref_name }}
helm push ./chorus-${{ steps.chartVer.outputs.result }}.tgz oci://${{ env.REGISTRY }}/chorus
# publish github Release
release:
needs: helm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Install zip
uses: montudor/action-zip@v1
- name: Build standalone binaries
run: |
mkdir standalone
platforms=("darwin/amd64" "darwin/arm64" "linux/386" "linux/amd64" "linux/arm64" "windows/amd64" "windows/386" )
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
bin_name='chorus'
output_name='standalone_'${{ github.ref_name }}'_'$GOOS'_'$GOARCH
if [ $GOOS = "windows" ]; then
bin_name+='.exe'
output_name+='.zip'
else
output_name+='.tar.gz'
fi
env GOOS=$GOOS GOARCH=$GOARCH go build -o $bin_name ./cmd/chorus
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
if [ $GOOS = "windows" ]; then
zip -r standalone/$output_name ./$bin_name
else
tar -cvzf standalone/$output_name ./$bin_name
fi
rm ./$bin_name
done
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: v1.25.1
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BREW_RELEASE_TOKEN: ${{ secrets.BREW_RELEASE_TOKEN }}
# helm:
# needs: docker
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: read chart version
# id: chartVer
# uses: mikefarah/[email protected]
# with:
# cmd: yq '.version' deploy/chorus/Chart.yaml
# - name: Install helm
# uses: azure/[email protected]
# - name: Publish chart
# run: |
# echo "${{ steps.chartVer.outputs.result }}"
# helm registry login -u '${{ secrets.DOCKER_USER }}' -p ${{ secrets.DOCKER_PASSWORD }} ${{ env.REGISTRY }}
# helm package ./deploy/chorus --app-version=${{ github.ref_name }}
# helm push ./chorus-${{ steps.chartVer.outputs.result }}.tgz oci://${{ env.REGISTRY }}/chorus
# # publish github Release
# release:
# needs: helm
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v4
# with:
# go-version: "1.21"
# - name: Install zip
# uses: montudor/action-zip@v1
# - name: Build standalone binaries
# run: |
# mkdir standalone
# platforms=("darwin/amd64" "darwin/arm64" "linux/386" "linux/amd64" "linux/arm64" "windows/amd64" "windows/386" )
# for platform in "${platforms[@]}"
# do
# platform_split=(${platform//\// })
# GOOS=${platform_split[0]}
# GOARCH=${platform_split[1]}
# bin_name='chorus'
# output_name='standalone_'${{ github.ref_name }}'_'$GOOS'_'$GOARCH
# if [ $GOOS = "windows" ]; then
# bin_name+='.exe'
# output_name+='.zip'
# else
# output_name+='.tar.gz'
# fi
# env GOOS=$GOOS GOARCH=$GOARCH go build -o $bin_name ./cmd/chorus
# if [ $? -ne 0 ]; then
# echo 'An error has occurred! Aborting the script execution...'
# exit 1
# fi
# if [ $GOOS = "windows" ]; then
# zip -r standalone/$output_name ./$bin_name
# else
# tar -cvzf standalone/$output_name ./$bin_name
# fi
# rm ./$bin_name
# done
#
# - name: Run GoReleaser
# uses: goreleaser/goreleaser-action@v5
# with:
# # either 'goreleaser' (default) or 'goreleaser-pro'
# distribution: goreleaser
# version: v1.25.1
# args: release --clean
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# BREW_RELEASE_TOKEN: ${{ secrets.BREW_RELEASE_TOKEN }}
9 changes: 8 additions & 1 deletion service/proxy/auth/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ import (
"crypto/hmac"
"crypto/sha256"
"encoding/xml"
"net/http"
"net/http/httputil"

xctx "github.com/clyso/chorus/pkg/ctx"
"github.com/clyso/chorus/pkg/log"
"github.com/clyso/chorus/pkg/s3"
"github.com/clyso/chorus/pkg/util"
mclient "github.com/minio/minio-go/v7"
"net/http"
"github.com/rs/zerolog"
)

func Middleware(conf *Config, storages map[string]s3.Storage) *middleware {
Expand Down Expand Up @@ -73,6 +76,10 @@ func (m *middleware) Wrap(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user, err := m.isReqAuthenticated(r)
if err != nil {
if zerolog.GlobalLevel() < zerolog.InfoLevel {
reqDump, _ := httputil.DumpRequest(r, false)
zerolog.Ctx(r.Context()).Debug().Str("http_req_dump", string(reqDump)).Msg("auth check failed for request")
}
util.WriteError(r.Context(), w, err)
return
}
Expand Down

0 comments on commit 363c257

Please sign in to comment.