Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,5 @@ cover.out

# Local env vars
.env
src.txt
src.txt.*
2 changes: 1 addition & 1 deletion CO_AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ When a commit is made to a repository that has co-authors support enabled, the b

If it does, the backend will process the co-authors as follows, assume trailer value is `name <email>` like `Lukasz Gryglicki <lukaszgryglicki@o2.pl>`:

- First we check if email is in format `nuber+username@users.noreply.github.com`. If it is we use number part as GitHub user ID and fetch the user from GitHub API. If the user is found, we use that user as co-author.
- First we check if email is in format `number+username@users.noreply.github.com`. If it is we use number part as GitHub user ID and fetch the user from GitHub API. If the user is found, we use that user as co-author.

- Second we check if email is in format `username@users.noreply.github.com`. If it is we use username part as GitHub username/login and fetch the user from GitHub API. If the user is found, we use that user as co-author.

Expand Down
10 changes: 9 additions & 1 deletion cla-backend-go/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ type combinedRepo struct {
projects_cla_groups.Repository
}

// in cmd/server.go (top-level imports already use logrus)
Comment thread
lukaszgryglicki marked this conversation as resolved.
func apiPathLogger(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log.Infof("LG:api-request-path:%s", r.URL.Path)
next.ServeHTTP(w, r)
})
}

// server function called by environment specific server functions
func server(localMode bool) http.Handler {
f := logrus.Fields{
Expand Down Expand Up @@ -398,7 +406,7 @@ func server(localMode bool) http.Handler {
// The middleware configuration is for the handler executors. These do not apply to the swagger.json document.
// The middleware executes after routing but before authentication, binding and validation
middlewareSetupfunc := func(handler http.Handler) http.Handler {
return setRequestIDHandler(responseLoggingMiddleware(userCreaterMiddleware(handler)))
return apiPathLogger(setRequestIDHandler(responseLoggingMiddleware(userCreaterMiddleware(handler))))
}

v2API.CsvProducer = openapi_runtime.ProducerFunc(func(w io.Writer, data interface{}) error {
Expand Down
5 changes: 2 additions & 3 deletions cla-backend-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ require (
)

require (
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1
github.com/bradleyfalzon/ghinstallation/v2 v2.2.0
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/golang-jwt/jwt/v4 v4.5.0
)

require (
github.com/ProtonMail/go-crypto v0.0.0-20230321155629-9a39f2531310 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/cloudflare/circl v1.3.2 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
Expand All @@ -86,7 +86,6 @@ require (
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-github/v50 v50.2.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
Expand Down
14 changes: 7 additions & 7 deletions cla-backend-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/LF-Engineering/aws-lambda-go-api-proxy v0.3.2 h1:ZLAgTj9+H3RTmjbRpUamMO8SWS1m4ZKJGGeh9lT985U=
github.com/LF-Engineering/aws-lambda-go-api-proxy v0.3.2/go.mod h1:LQj48zwkRwdjVmDCqtPlviW/7IFaSKzz2gDhxRwVrA4=
github.com/LF-Engineering/lfx-kit v0.1.33 h1:UI0vP7zFqolFdF68N0LDB1cKTU1Y16DbqjEiDt9rNKo=
github.com/LF-Engineering/lfx-kit v0.1.33/go.mod h1:e2dnnqQtojsnFX5rmZpWcZNfHirnLrAys0Jak9pdijM=
github.com/LF-Engineering/lfx-kit v0.1.39 h1:mVLXRX7m6ytkLLt+Gf9T4Fhg8PKHcPzUic7OomefuiM=
github.com/LF-Engineering/lfx-kit v0.1.39/go.mod h1:TT7IqcXmeD63smE3ieHemt+J032MJObsxWJhF1GP4HQ=
github.com/LF-Engineering/lfx-models v0.7.9 h1:xuEvRk9b3Nc57i3Hl5mpH3wKG59z38H4rdWd/TXmNmk=
Expand Down Expand Up @@ -70,7 +68,6 @@ github.com/aws/aws-lambda-go v1.22.0/go.mod h1:jJmlefzPfGnckuHdXX7/80O3BvUUi12XO
github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48=
github.com/aws/aws-sdk-go v1.36.27 h1:wc3xLJJHog2SwiqlLnrLUuct/n+dBjB45QhuZw2psVE=
github.com/aws/aws-sdk-go v1.36.27/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA=
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 h1:6cnno47Me9bRykw9AEv9zkXE+5or7jz8TsskTTccbgc=
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1/go.mod h1:qmdkIIAC+GCLASF7R2whgNrJADz0QZPX+Seiw/i4S3o=
github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q=
Expand Down Expand Up @@ -105,8 +102,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185/go.mod h1:cFRxtTwTOJkz2x3rQUNCYKWC93yP1VKjR8NUhqFxZNU=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
Expand All @@ -119,6 +114,7 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
Expand Down Expand Up @@ -363,6 +359,7 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v0.0.0-20180120075819-c0091a029979/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
Expand All @@ -374,6 +371,7 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM=
github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-retryablehttp v0.6.8 h1:92lWxgpa+fF3FozM4B3UZtHZMJX8T5XT+TFdCxsPyWs=
github.com/hashicorp/go-retryablehttp v0.6.8/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
Expand Down Expand Up @@ -413,6 +411,7 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/juju/mempool v0.0.0-20160205104927-24974d6c264f h1:a3Vd00a20dTKLpyS2hdUafNG5zxQdTw5KhDMK5C0a8U=
github.com/juju/mempool v0.0.0-20160205104927-24974d6c264f/go.mod h1:+7K7MqWi5xWI+s1LyB2g0Di71jZo27y+XOlmhNtV1Y0=
github.com/juju/zip v0.0.0-20160205105221-f6b1e93fa2e2 h1:McU3wXjBrKfJcOt2Pali5qEir9NLrqOh4EECzdWHknM=
Expand Down Expand Up @@ -532,7 +531,9 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=
github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
Expand Down Expand Up @@ -613,6 +614,7 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/ratelimit v0.1.0 h1:U2AruXqeTb4Eh9sYQSTrMhH8Cb7M0Ian2ibBOnBcnAw=
go.uber.org/ratelimit v0.1.0/go.mod h1:2X8KaoNd1J0lZV+PxJk/5+DGbO/tpwLR1m++a7FnB/Y=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand Down Expand Up @@ -805,8 +807,6 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down
150 changes: 150 additions & 0 deletions utils/dump_repo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
#!/usr/bin/env python3
import argparse, os, sys, pathlib, io, subprocess, shutil

DEFAULT_EXCLUDE_DIRS = {".git", ".hg", ".svn", ".idea", ".vscode", "dist", "build", "out", "target", ".next", ".nuxt", ".tox", "__pycache__"}
DEFAULT_EXCLUDE_GLOBS = {"*.min.js", "*.map", "*.lock", "*.jar", "*.zip", "*.gz", "*.tgz", "*.bz2", "*.7z", "*.png",
"*.jpg", "*.jpeg", "*.gif", "*.webp", "*.ico", "*.pdf", "*.woff", "*.woff2", "*.ttf", "*.otf",
"*.mp4", "*.mov", "*.avi", "*.mp3", "*.flac", "*.wav", "*.iso", "*.bin", "*.secret"}
DEFAULT_INCLUDE_EXTS = {
".go",".ts",".tsx",".js",".jsx",".json",".yml",".yaml",".toml",".ini",".env",".md",".txt",
".proto",".graphql",".sql",".py",".rs",".java",".c",".h",".cpp",".hpp",".cc",".m",".mm",
".rb",".php",".pl",".sh",".bash",".zsh",".fish",".ps1",".bat",".dockerfile",".gradle",".properties"
}
ALSO_ALLOW_NAME = {"dockerfile", "makefile", "makefile.win"}

def is_text_file(path: str, max_probe=65536) -> bool:
try:
with open(path, "rb") as f:
chunk = f.read(max_probe)
if b"\x00" in chunk:
return False
chunk.decode("utf-8", errors="strict")
return True
except Exception:
return False

def should_keep_by_ext(p: pathlib.Path, include_exts) -> bool:
if include_exts and p.suffix.lower() not in include_exts:
if p.name.lower() not in ALSO_ALLOW_NAME:
return False
return True

def should_exclude_by_glob(rel: str) -> bool:
from pathlib import PurePath
pp = PurePath(rel)
for g in DEFAULT_EXCLUDE_GLOBS:
if pp.match(g):
return True
return False

def git_available() -> bool:
return shutil.which("git") is not None

def iter_files_git(repo_root: pathlib.Path):
"""
Yields repo files not ignored by .gitignore/.git/info/exclude/global ignores.
Uses: git ls-files --cached --others --exclude-standard
"""
cmd = ["git", "-C", str(repo_root), "ls-files", "-z", "--cached", "--others", "--exclude-standard", "--"]
out = subprocess.check_output(cmd)
for rel_b in out.split(b"\x00"):
if not rel_b:
continue
rel = rel_b.decode("utf-8", errors="replace")
p = repo_root / rel
if p.is_file():
yield p

def iter_files_walk(repo_root: pathlib.Path):
"""
Fallback: walk the tree and filter manually (does NOT perfectly mirror .gitignore).
"""
for root, dirs, files in os.walk(repo_root):
# prune common junk dirs
dirs[:] = [d for d in dirs if d not in DEFAULT_EXCLUDE_DIRS]
for name in files:
p = pathlib.Path(root) / name
rel = p.relative_to(repo_root).as_posix()
if should_exclude_by_glob(rel):
continue
yield p

def iter_repo_files(repo_root: pathlib.Path, use_git: bool):
if use_git:
yield from iter_files_git(repo_root)
else:
# use git if available and .git exists
if (repo_root/".git").exists() and git_available():
yield from iter_files_git(repo_root)
else:
yield from iter_files_walk(repo_root)

def write_repo(repo_root: pathlib.Path, out_prefix: pathlib.Path, max_mb: float, force_git: bool):
repo_root = repo_root.resolve()
max_bytes = int(max_mb * (1024**2))
chunk_idx = 1
bytes_in_chunk = 0

def open_chunk(idx):
suffix = "" if idx == 1 else f".part{idx}"
path = out_prefix if idx == 1 else out_prefix.with_name(out_prefix.name + suffix)
return path, io.open(path, "w", encoding="utf-8", newline="\n")

out_path, fh = open_chunk(chunk_idx)

count = 0
for p in iter_repo_files(repo_root, force_git):
rel = p.relative_to(repo_root).as_posix()
if should_exclude_by_glob(rel):
continue
if not should_keep_by_ext(p, DEFAULT_INCLUDE_EXTS):
continue
if not is_text_file(str(p)):
continue

header = f"File: {rel}\nContents:\n"
try:
with io.open(p, "r", encoding="utf-8") as rf:
content = rf.read()
except UnicodeDecodeError:
with io.open(p, "r", encoding="latin-1") as rf:
content = rf.read()

block = header + content.rstrip() + "\n\n"
block_bytes = len(block.encode("utf-8"))

if bytes_in_chunk + block_bytes > max_bytes and bytes_in_chunk > 0:
fh.close()
chunk_idx += 1
out_path, fh = open_chunk(chunk_idx)
bytes_in_chunk = 0

fh.write(block)
bytes_in_chunk += block_bytes
count += 1

fh.close()
return chunk_idx, count

def main():
ap = argparse.ArgumentParser(description="Dump repo sources to 'File: ...\\nContents:\\n...' format, honoring .gitignore.")
ap.add_argument("--repo", default=".", help="Path to repo root (default: .)")
ap.add_argument("--out", default="src.txt", help="Output filename/prefix")
ap.add_argument("--max-mb", type=float, default=100.0, help="Max size per output file in MB (default: 100MB)")
ap.add_argument("--git-mode", action="store_true", help="Force using 'git ls-files' (best accuracy for .gitignore).")
args = ap.parse_args()

repo_root = pathlib.Path(args.repo)
out_prefix = pathlib.Path(args.out)

try:
chunks, files = write_repo(repo_root, out_prefix, args.max_mb, args.git_mode)
print(f"Wrote {chunks} file(s); included {files} text source files. Upload the first file and any '.partN' files too.")
except subprocess.CalledProcessError as e:
print("Warning: Git mode failed; falling back to walk() (may include gitignored files).", file=sys.stderr)
chunks, files = write_repo(repo_root, out_prefix, args.max_mb, force_git=False)
print(f"Wrote {chunks} file(s); included {files} text source files. Upload the first file and any '.partN' files too.")

if __name__ == "__main__":
sys.exit(main())

7 changes: 6 additions & 1 deletion utils/get_company_project_cla_managers.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/bin/bash
# API_URL=https://[xyz].ngrok-free.app (defaults to localhost:5000)
# API_URL=https://api.lfcla.dev.platform.linuxfoundation.org
# API_URL=https://api-gw.platform.linuxfoundation.org/cla-service
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service
# DEBUG='' ./utils/get_company_project_cla_managers.sh f7c7ac9c-4dbf-4104-ab3f-6b38a26d82dc a09P000000DsCE5IAN
# Note: To run manually see cla-backend-go/auth/authorizer.go:SecurityAuth() and update accordingly 'LG:'
# STAGE=prod ./utils/scan.sh projects-cla-groups project_name 'Cloud Native Computing Foundation (CNCF)'
# STAGE=prod ./utils/scan.sh companies company_name 'Red Hat, Inc.'
# ./get_oauth_token_prod.sh
# DEBUG='' API_URL=https://api-gw.platform.linuxfoundation.org/cla-service ./utils/get_company_project_cla_managers.sh '86fda258-9866-45e3-b4fe-50502ac0957c' 'a0941000002wBz4AAE'

if [ -z "$TOKEN" ]
then
Expand Down
49 changes: 49 additions & 0 deletions utils/notify_cla_managers_example_post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
# API_URL=https://api-gw.platform.linuxfoundation.org/cla-service
# API_URL=https://api-gw.dev.platform.linuxfoundation.org/cla-service
# STAGE=prod ./utils/scan.sh projects project_id d8cead54-92b7-48c5-a2c8-b1e295e8f7f1
# STAGE=prod ./utils/scan.sh projects-cla-groups project_name 'Cloud Native Computing Foundation (CNCF)'
# STAGE=prod ./utils/scan.sh companies company_name 'Red Hat, Inc.'
# STAGE=prod ./utils/scan.sh users lf_username lgryglicki
# API_URL=https://api-gw.platform.linuxfoundation.org/cla-service ./utils/notify_cla_managers_example_post.sh

if [ -z "$TOKEN" ]
then
# source ./auth0_token.secret
TOKEN="$(cat ./auth0.token.secret)"
fi

if [ -z "$TOKEN" ]
then
echo "$0: TOKEN not specified and unable to obtain one"
exit 1
fi

if [ -z "$XACL" ]
then
XACL="$(cat ./x-acl.secret)"
fi

if [ -z "$XACL" ]
then
echo "$0: XACL not specified and unable to obtain one"
exit 2
fi

if [ -z "$API_URL" ]
then
export API_URL="http://localhost:5001"
fi

data='{
"companyName": "Cloud Native Computing Foundation (CNCF)",
"claGroupID": "d8cead54-92b7-48c5-a2c8-b1e295e8f7f1",
"userID": "2c895887-d33a-11ef-9205-4e2baeedbda2",
Comment thread
lukaszgryglicki marked this conversation as resolved.
"list": [
{ "email": "lukaszgryglicki@o2.pl", "name": "Lukasz Gryglicki 1" },
{ "email": "lgryglicki@cncf.io", "name": "Lukasz Gryglicki 2" },
{ "email": "lgryglicki@contractor.linuxfoundation.org", "name": "Lukasz Gryglicki 3" }
Comment thread
lukaszgryglicki marked this conversation as resolved.
]
}'

curl -s -XPOST -H "X-ACL: ${XACL}" -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" "${API_URL}/v4/notify-cla-managers" -d "$data" | jq -r '.'
Loading