diff --git a/.dockerignore b/.dockerignore index 3ffea5795..caf1a8df8 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,8 +7,4 @@ release coverage.out # ignore any executables we build -/gitness -/gitrpcserver -/gitness-githook -/githaserver -/githa-githook \ No newline at end of file +/gitness \ No newline at end of file diff --git a/.gitignore b/.gitignore index 93ca4f9d9..5e6a2cbad 100644 --- a/.gitignore +++ b/.gitignore @@ -16,8 +16,4 @@ coverage.out gitness.session.sql # ignore any executables we build -/gitness -/gitrpcserver -/gitness-githook -/githaserver -/githa-githook \ No newline at end of file +/gitness \ No newline at end of file diff --git a/.gitleaksignore b/.gitleaksignore deleted file mode 100644 index 12d727337..000000000 --- a/.gitleaksignore +++ /dev/null @@ -1,43 +0,0 @@ -harness/.dev.env:generic-api-key:35 -harness/.dev.env:generic-api-key:38 -47043d50c5b406b36d34f066cbe2aa4eefba6de4:harness/tools/code-api/chart/values.yaml:generic-api-key:96 -47043d50c5b406b36d34f066cbe2aa4eefba6de4:harness/tools/code-api/chart/values.yaml:generic-api-key:99 -47043d50c5b406b36d34f066cbe2aa4eefba6de4:harness/tools/code-api/chart/values.yaml:generic-api-key:100 -47043d50c5b406b36d34f066cbe2aa4eefba6de4:harness/tools/code-api/chart/values.yaml:generic-api-key:101 -47043d50c5b406b36d34f066cbe2aa4eefba6de4:harness/tools/code-api/chart/values.yaml:generic-api-key:102 -2477cba2ae5789cd9d7cd39a0e58d8822d616904:internal/api/controller/repo/pr_description.go:jwt:18 -55af658081445a458d807c3262ace49124e15c16:harness/tools/code-api/chart/values.yaml:generic-api-key:101 -55af658081445a458d807c3262ace49124e15c16:harness/tools/code-api/chart/values.yaml:generic-api-key:104 -55af658081445a458d807c3262ace49124e15c16:harness/tools/code-api/chart/values.yaml:generic-api-key:105 -55af658081445a458d807c3262ace49124e15c16:harness/tools/code-api/chart/values.yaml:generic-api-key:106 -55af658081445a458d807c3262ace49124e15c16:harness/tools/code-api/chart/values.yaml:generic-api-key:107 -55eda6c54050b68d122f87668ee0f70337239dd5:harness/tools/code-api/chart/values.yaml:generic-api-key:101 -55eda6c54050b68d122f87668ee0f70337239dd5:harness/tools/code-api/chart/values.yaml:generic-api-key:104 -55eda6c54050b68d122f87668ee0f70337239dd5:harness/tools/code-api/chart/values.yaml:generic-api-key:105 -55eda6c54050b68d122f87668ee0f70337239dd5:harness/tools/code-api/chart/values.yaml:generic-api-key:106 -55eda6c54050b68d122f87668ee0f70337239dd5:harness/tools/code-api/chart/values.yaml:generic-api-key:107 -d031a5f14fc1678ab7caa0d00270fd152dcc7c96:harness/.example.env:generic-api-key:13 -0453dad7bf8e809daa346c842053686ea06290e3:harness/.dev.env:generic-api-key:13 -0453dad7bf8e809daa346c842053686ea06290e3:harness/.dev.env:generic-api-key:15 -0453dad7bf8e809daa346c842053686ea06290e3:harness/.dev.env:generic-api-key:18 -0453dad7bf8e809daa346c842053686ea06290e3:harness/.dev.env:generic-api-key:27 -0453dad7bf8e809daa346c842053686ea06290e3:harness/.dev.env:generic-api-key:32 -038fe3147d8f8aae7961776fe45cbac1a7952845:harness/.dev.env:generic-api-key:13 -038fe3147d8f8aae7961776fe45cbac1a7952845:harness/.dev.env:generic-api-key:15 -038fe3147d8f8aae7961776fe45cbac1a7952845:harness/.dev.env:generic-api-key:18 -038fe3147d8f8aae7961776fe45cbac1a7952845:harness/.dev.env:generic-api-key:27 -038fe3147d8f8aae7961776fe45cbac1a7952845:harness/.dev.env:generic-api-key:32 -5edb3c8aa59d8e32c02b95476a01d21dc5b56007:harness/tools/chart/code-api/values.yaml:generic-api-key:69 -5edb3c8aa59d8e32c02b95476a01d21dc5b56007:harness/tools/chart/code-api/values.yaml:generic-api-key:72 -5edb3c8aa59d8e32c02b95476a01d21dc5b56007:harness/tools/chart/code-api/values.yaml:generic-api-key:73 -5edb3c8aa59d8e32c02b95476a01d21dc5b56007:harness/tools/chart/code-api/values.yaml:generic-api-key:74 -5edb3c8aa59d8e32c02b95476a01d21dc5b56007:harness/tools/chart/code-api/values.yaml:generic-api-key:75 -92ffddafe4737f3e7bd34ef8144dcfb4535e239a:.harness.env:generic-api-key:29 -187bbdfd7f63a06c5617b64b240e515d0bb6f524:.harness.env:generic-api-key:14 -187bbdfd7f63a06c5617b64b240e515d0bb6f524:.harness.env:generic-api-key:23 -187bbdfd7f63a06c5617b64b240e515d0bb6f524:.harness.env:generic-api-key:28 -f72b73367c4ed871fddbe1a269f8f7c151b0caff:.harness.env:generic-api-key:3 -f72b73367c4ed871fddbe1a269f8f7c151b0caff:.harness.env:generic-api-key:6 -f72b73367c4ed871fddbe1a269f8f7c151b0caff:.harness.env:generic-api-key:8 -f72b73367c4ed871fddbe1a269f8f7c151b0caff:.harness.env:generic-api-key:10 -f72b73367c4ed871fddbe1a269f8f7c151b0caff:.harness.env:generic-api-key:12 \ No newline at end of file diff --git a/.local.env b/.local.env index ed635ad02..1e50561d8 100644 --- a/.local.env +++ b/.local.env @@ -1,5 +1,4 @@ GITNESS_TRACE=true GITNESS_WEBHOOK_ALLOW_LOOPBACK=true GITNESS_PRINCIPAL_ADMIN_PASSWORD=changeit -GITNESS_METRIC_ENABLED=false -GITNESS_METRIC_ENDPOINT=http://localhost/api/v1/gitness \ No newline at end of file +GITNESS_METRIC_ENABLED=false \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 8544d2ad4..c49acb16a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,16 +5,7 @@ "version": "0.2.0", "configurations": [ { - "name": "Harness", - "type": "go", - "request": "launch", - "mode": "auto", - "buildFlags": "-tags=sqlite", - "program": "./harness", - "args": ["server", ".dev.env"] - }, - { - "name": "Standalone", + "name": "Gitness", "type": "go", "request": "launch", "mode": "auto", diff --git a/Dockerfile b/Dockerfile index e325abdf9..04e55a99d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,10 +30,6 @@ WORKDIR /app COPY go.mod . COPY go.sum . -# TODO: REMOVE ONCE WE SPLIT REPOS -RUN sed -i '/go-rbac/d' go.mod -RUN sed -i '/go-rbac/d' go.sum - COPY Makefile . RUN make dep RUN make tools diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..59be1e811 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 Harness, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 3015697a5..000000000 --- a/LICENSE.md +++ /dev/null @@ -1,93 +0,0 @@ -# PolyForm Free Trial License 1.0.0 - - - -## Acceptance - -In order to get any license under these terms, you must agree -to them as both strict obligations and conditions to all -your licenses. - -## Copyright License - -The licensor grants you a copyright license for the software -to do everything you might do with the software that would -otherwise infringe the licensor's copyright in it for any -permitted purpose. However, you may only make changes or -new works based on the software according to [Changes and New -Works License](#changes-and-new-works-license), and you may -not distribute copies of the software. - -## Changes and New Works License - -The licensor grants you an additional copyright license to -make changes and new works based on the software for any -permitted purpose. - -## Patent License - -The licensor grants you a patent license for the software that -covers patent claims the licensor can license, or becomes able -to license, that you would infringe by using the software. - -## Fair Use - -You may have "fair use" rights for the software under the -law. These terms do not limit them. - -## Free Trial - -Use to evaluate whether the software suits a particular -application for less than 32 consecutive calendar days, on -behalf of you or your company, is use for a permitted purpose. - -## No Other Rights - -These terms do not allow you to sublicense or transfer any of -your licenses to anyone else, or prevent the licensor from -granting licenses to anyone else. These terms do not imply -any other licenses. - -## Patent Defense - -If you make any written claim that the software infringes or -contributes to infringement of any patent, your patent license -for the software granted under these terms ends immediately. If -your company makes such a claim, your patent license ends -immediately for work on behalf of your company. - -## Violations - -If you violate any of these terms, or do anything with the -software not covered by your licenses, all your licenses -end immediately. - -## No Liability - -***As far as the law allows, the software comes as is, without -any warranty or condition, and the licensor will not be liable -to you for any damages arising out of these terms or the use -or nature of the software, under any kind of legal claim.*** - -## Definitions - -The **licensor** is the individual or entity offering these -terms, and the **software** is the software the licensor makes -available under these terms. - -**You** refers to the individual or entity agreeing to these -terms. - -**Your company** is any legal entity, sole proprietorship, -or other kind of organization that you work for, plus all -organizations that have control over, are under the control of, -or are under common control with that organization. **Control** -means ownership of substantially all the assets of an entity, -or the power to direct its management and policies by vote, -contract, or otherwise. Control can be direct or indirect. - -**Your licenses** are all the licenses granted to you for the -software under these terms. - -**Use** means anything you do with the software requiring one -of your licenses. \ No newline at end of file diff --git a/Makefile b/Makefile index 611c68301..b8d717592 100644 --- a/Makefile +++ b/Makefile @@ -33,9 +33,6 @@ init: ## Install git hooks to perform pre-commit checks git config core.hooksPath .githooks git config commit.template .gitmessage -all: dep tools generate lint build test ## Build and run the test for gitness - @echo "Run `make start` to start the services" - dep: $(deps) ## Install the deps required to generate code and build gitness @echo "Installing dependencies" @go mod download @@ -53,25 +50,9 @@ build: generate ## Build the all-in-one gitness binary @echo "Building Gitness Server" go build -tags=${BUILD_TAGS} -ldflags=${LDFLAGS} -o ./gitness ./cmd/gitness -build-gitrpc: generate ## Build the gitrpc binary - @echo "Building GitRPC Server" - go build -tags=${BUILD_TAGS} -ldflags=${LDFLAGS} -o ./gitrpcserver ./cmd/gitrpcserver - -build-githook: generate ## Build the githook binary for gitness - @echo "Building gitness GitHook Binary" - go build -tags=${BUILD_TAGS} -ldflags=${LDFLAGS} -o ./gitness-githook ./cmd/gitness-githook - -build-githa: generate ## Build the githa server binary - @echo "Building GitHA Server" - go build -tags=${BUILD_TAGS} -ldflags=${LDFLAGS} -o ./githaserver ./cmd/githaserver - -build-githa-githook: generate ## Build the githook binary for githa - @echo "Building githa GitHook Binary" - go build -tags=${BUILD_TAGS} -ldflags=${LDFLAGS} -o ./githa-githook ./cmd/githa-githook - test: generate ## Run the go tests @echo "Running tests" - go test -v -coverprofile=coverage.out ./internal/... + go test -v -coverprofile=coverage.out ./... go tool cover -html=coverage.out run: dep ## Run the gitness binary from source @@ -107,21 +88,13 @@ lint: tools generate # lint the golang code generate: wire proto @echo "Generating Code" -wire: cmd/gitness/wire_gen.go cmd/gitrpcserver/wire_gen.go cmd/githaserver/wire_gen.go +wire: cmd/gitness/wire_gen.go force-wire: ## Force wire code generation - @sh ./scripts/wire/server/standalone.sh - @sh ./scripts/wire/gitrpcserver/wire.sh - @sh ./scripts/wire/githaserver/wire.sh + @sh ./scripts/wire/gitness.sh cmd/gitness/wire_gen.go: cmd/gitness/wire.go - @sh ./scripts/wire/server/standalone.sh - -cmd/gitrpcserver/wire_gen.go: cmd/gitrpcserver/wire.go - @sh ./scripts/wire/gitrpcserver/wire.sh - -cmd/githaserver/wire_gen.go: cmd/githaserver/wire.go - @sh ./scripts/wire/githaserver/wire.sh + @sh ./scripts/wire/gitness.sh proto: ## generate proto files for gitrpc integration @protoc --proto_path=./gitrpc/proto \ diff --git a/go.mod b/go.mod index 91cc84166..ec6dc6e3f 100644 --- a/go.mod +++ b/go.mod @@ -26,14 +26,12 @@ require ( github.com/go-redis/redis/v8 v8.11.5 github.com/go-redsync/redsync/v4 v4.7.1 github.com/golang-jwt/jwt v3.2.2+incompatible - github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.5.9 github.com/google/wire v0.5.0 github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75 github.com/gotidy/ptr v1.4.0 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/guregu/null v4.0.0+incompatible - github.com/harness/go-rbac v0.0.0-20230829014129-c9b217856ea2 github.com/hashicorp/go-multierror v1.1.1 github.com/jmoiron/sqlx v1.3.3 github.com/joho/godotenv v1.3.0 @@ -109,7 +107,6 @@ require ( require ( github.com/go-logr/logr v1.2.4 - github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/zerologr v1.2.3 github.com/mattn/go-colorable v0.1.13 // indirect ) @@ -163,7 +160,7 @@ require ( google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect - gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 // indirect ) diff --git a/go.sum b/go.sum index 296fc7c51..71cbbfe5b 100644 --- a/go.sum +++ b/go.sum @@ -202,11 +202,8 @@ github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgO github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zerologr v1.2.3 h1:up5N9vcH9Xck3jJkXzgyOxozT14R47IyDODz8LM1KSs= github.com/go-logr/zerologr v1.2.3/go.mod h1:BxwGo7y5zgSHYR1BjbnHPyF/5ZjVKfKxAZANVu6E8Ho= github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= @@ -250,7 +247,6 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -324,8 +320,6 @@ github.com/guregu/null v4.0.0+incompatible h1:4zw0ckM7ECd6FNNddc3Fu4aty9nTlpkkzH github.com/guregu/null v4.0.0+incompatible/go.mod h1:ePGpQaN9cw0tj45IR5E5ehMvsFlLlQZAkkOXZurJ3NM= github.com/h2non/gock v1.0.9 h1:17gCehSo8ZOgEsFKpQgqHiR7VLyjxdAG3lkhVvO9QZU= github.com/h2non/gock v1.0.9/go.mod h1:CZMcB0Lg5IWnr9bF79pPMg9WeV6WumxQiUJ1UvdO1iE= -github.com/harness/go-rbac v0.0.0-20230829014129-c9b217856ea2 h1:M1Jd2uEKl4YW9g/6vzN1qo06d5dshYYdwxlhOTUSnh4= -github.com/harness/go-rbac v0.0.0-20230829014129-c9b217856ea2/go.mod h1:uGgBgSZPgyygG5rWzoYsKIQ8TM4zt5yQq9nreznWvOI= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= @@ -702,7 +696,6 @@ github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCO github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= @@ -795,7 +788,6 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -859,9 +851,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -926,7 +916,6 @@ golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= diff --git a/internal/api/openapi/principals.go b/internal/api/openapi/principals.go index 5b9fe45fe..6108b7bf9 100644 --- a/internal/api/openapi/principals.go +++ b/internal/api/openapi/principals.go @@ -43,22 +43,6 @@ var queryParameterQueryPrincipals = openapi3.ParameterOrRef{ }, } -// TODO: this should not be in standalone swagger. -// https://harness.atlassian.net/browse/CODE-521 -var queryParameterAccountID = openapi3.ParameterOrRef{ - Parameter: &openapi3.Parameter{ - Name: "accountIdentifier", - In: openapi3.ParameterInQuery, - Description: ptr.String("The account ID the principals are retrieved for (Not required in standalone)."), - Required: ptr.Bool(false), - Schema: &openapi3.SchemaOrRef{ - Schema: &openapi3.Schema{ - Type: ptrSchemaType(openapi3.SchemaTypeString), - }, - }, - }, -} - var queryParameterPrincipalTypes = openapi3.ParameterOrRef{ Parameter: &openapi3.Parameter{ Name: request.QueryParamType, @@ -85,7 +69,7 @@ func buildPrincipals(reflector *openapi3.Reflector) { opList := openapi3.Operation{} opList.WithTags("principals") opList.WithMapOfAnything(map[string]interface{}{"operationId": "listPrincipals"}) - opList.WithParameters(queryParameterQueryPrincipals, queryParameterAccountID, queryParameterPage, + opList.WithParameters(queryParameterQueryPrincipals, queryParameterPage, queryParameterLimit, queryParameterPrincipalTypes) _ = reflector.SetRequest(&opList, new(principalRequest), http.MethodGet) _ = reflector.SetJSONResponse(&opList, new([]types.PrincipalInfo), http.StatusOK) diff --git a/scripts/wire/gitness.sh b/scripts/wire/gitness.sh new file mode 100755 index 000000000..c28b47b3e --- /dev/null +++ b/scripts/wire/gitness.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env sh +# Copyright 2023 Harness, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http:#www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +echo "Updating cmd/gitness/wire_gen.go" +go run github.com/google/wire/cmd/wire gen github.com/harness/gitness/cmd/gitness \ No newline at end of file diff --git a/scripts/wire/server/standalone.sh b/scripts/wire/server/standalone.sh deleted file mode 100755 index ed3f58866..000000000 --- a/scripts/wire/server/standalone.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh - -echo "Updating cmd/gitness/wire_gen.go" -go run github.com/google/wire/cmd/wire gen github.com/harness/gitness/cmd/gitness \ No newline at end of file diff --git a/version/version_test.go b/version/version_test.go deleted file mode 100644 index dd834e1fe..000000000 --- a/version/version_test.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2023 Harness, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package version - -import "testing" - -func TestVersion(t *testing.T) { - if got, want := Version.String(), "1.0.0"; got != want { - t.Errorf("Want version %s, got %s", want, got) - } -}