Commit Graph

156 Commits

Author SHA1 Message Date
Johannes Batzill
5ca48e7f59 [MISC] Replace BIND with PORT, fix space_path for postgres (#607) 2023-09-25 22:34:45 +00:00
Johannes Batzill
1246bd78ab [MISC] improve url generation to reduce configuration overhead (#606) 2023-09-25 17:58:20 +00:00
Johannes Batzill
a83cd21c17 [OPEN-SOURCE] Prepare Repository (#605) 2023-09-24 07:33:16 +00:00
Vistaar Juneja
40af7bfa33 add plugins support for v1 YAML (#552) 2023-09-19 21:05:50 +00:00
Johannes Batzill
ae42cabc15 [Harness] Fix Harness Build (#488) 2023-09-14 16:23:07 +00:00
Enver Bisevac
53d277b108 metrics collector added 2023-09-14 13:25:44 +02:00
Johannes Batzill
8cd3e5d015 [Standalone] Add temporary JWT for pipeline executions (#480) 2023-09-14 08:54:03 +00:00
Johannes Batzill
0d086a1a4d [Events] This PR introduces the Trigger Service for Event Consumption + Some Minor improvements (#419) 2023-09-08 23:52:19 +00:00
Vistaar Juneja
9361734683 add ENABLE_CI and pass in CI implementations to harness wire 2023-09-07 18:50:35 +01:00
Vistaar Juneja
4c8302845d add logic to run executions 2023-09-07 11:07:49 +01:00
Marko Gaćeša
045d80c5bf background jobs 2023-08-29 17:57:09 +02:00
Hitesh Aringa
ce90c63d01 [CODE-717]: redis sentinel mode (#292) 2023-08-11 16:28:53 +00:00
Johannes Batzill
c8ce82d197 [Standalone] Make Token Expiration Optional & Fix CLI Register + Login (#239) 2023-07-26 01:03:03 +00:00
Johannes Batzill
45e48a2b05 [GITHA] Expose GRPC Server/Client Configurations for HA Kubernetes Deployment (#231) 2023-07-25 18:15:06 +00:00
Johannes Batzill
5543fba0b4 [GIHA] Introduce githa custom githook binary (#186) 2023-07-12 15:49:06 +00:00
Johannes Batzill
59e3bff412 fix missed error and linting errors 2023-06-26 11:37:08 -07:00
Johannes Batzill
63c45cb0db [GITHA] Prepare GITRPC for GITHA changes (HTTP Server, GRPC Operations: Sync, RemoteDefaultBranch, Deterministic CommitID) (#153) 2023-06-22 16:54:18 +00:00
Johannes Batzill
36e8bdb368 [GITHA] Introduce Generic store Package (#143) 2023-06-20 00:26:40 +00:00
Hitesh Aringa
34db95b900 [CODE-454]: go profiler (#125) 2023-06-19 23:38:47 +00:00
Johannes Batzill
d80fc15753 [GITHA] Prepare lock package (#144) 2023-06-19 15:35:46 +00:00
Enver Bisevac
43f0be35e0 [MAINT] Isolate harness app into harness package (#133) 2023-06-15 13:35:12 +00:00
Marko Gaćeša
cdc1370564 feat: [CODE-389]: status checks API layer 2023-06-08 12:38:20 +02:00
Atefeh Mohseni-Ejiyeh
0df1335855 [HARNESS] Delete Space on Harness Account/Org/Project deletion (#83) 2023-06-08 00:09:34 +00:00
Enver Bisevac
8ab5185263 fixed linter issues 2023-05-17 21:56:23 +02:00
Atefeh Mohseni-Ejiyeh
4b0dd89a6b Merge branch 'atmsn/code165' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#52) 2023-05-09 18:52:03 +00:00
atefeh
a309f4ec9b CODE 165-API for delete a space subspaces and their repositories 2023-05-09 09:21:25 -07:00
atefeh
8b335d1573 code195 repo delete cleanup, and added a cron manager for cronjobs and unit tests 2023-05-04 09:10:10 -07:00
Enver Bisevac
fffb37bfa2 Merge branch 'eb/rbac' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#25) 2023-04-19 15:29:46 +00:00
Johannes Batzill
89bb0f6b99 update gitRPC getBlob api to stream blob content, add 'raw' api. 2023-04-18 11:39:59 -07:00
Enver Bisevac
b092c1b8df added go-rbac dependency 2023-04-18 03:10:30 +02:00
Marko Gaćeša
13e4ffe522 Add code comments 2023-04-13 14:12:01 +02:00
Enver Bisevac
13a456e357 [scm-58] Add merge-check and Integrate with PR (#318)
Co-authored-by: Johannes Batzill <johannes.batzill@harness.io>
2023-02-11 23:22:12 -08:00
Marko Gaćeša
efcd415603 CLI migrate command (#304) 2023-02-07 12:50:46 +01:00
Johannes Batzill
9bec905a65 [MISC] Always create system service principal (#309) 2023-02-03 19:18:29 -08:00
Marko Gaćeša
89c135f94b Improve sanitize maching name fn (#303) 2023-02-03 18:56:20 +01:00
Marko Gaćeša
c8301fc842 cli session: Fix new session path (#302) 2023-02-03 14:19:06 +01:00
Marko Gaćeša
236e2ede9e Refactor cli app startup (#293) 2023-02-03 12:08:02 +01:00
Johannes Batzill
bf9906c4ce [API] Add principals API, move users to admin, simplify user/service/serviceaccount validation (#300) 2023-02-03 00:15:11 -08:00
Johannes Batzill
8f82c0ce4e [Webhook] Add Support for PR Branch Updated (#267) 2023-01-31 13:07:48 -08:00
Enver Bisevac
e2b350e704 [maint] pr statistic is in pr response now (#269) 2023-01-31 15:21:05 +01:00
Enver Bisevac
baa3822acc [SCM-55] initial work on PR metadata (#262) 2023-01-31 02:08:23 +01:00
Marko Gaćeša
4277c4c66b Simplify handling of PR events (#253) 2023-01-27 16:27:03 -08:00
Johannes Batzill
7da9bce7c1 [Githook] Add GitHook binary (#259)
This PR adds a githook sub-package to our cmd packages, introducing the githook binary.
The binary is linked as pre-receie/update/post-receive by gitrpc if configured.
This is required to have a gitrpc deployment without requiring the one-in-all gitness binary on the same machine.
2023-01-27 13:04:58 -08:00
Johannes Batzill
114cdb34e0 [GITRPC] Add GitRPC Binary (#257) 2023-01-27 10:34:42 -08:00
Johannes Batzill
bfb0466b11 [MISC] Move configurations to their respective packages (#256) 2023-01-26 17:30:26 -08:00
Enver Bisevac
1f86b3c73d [fix] merge commit is blocked with dbtx mutex lock (#245) 2023-01-26 13:41:45 +01:00
Marko Gaćeša
7a92d8e110 PR events and PR head ref (#244) 2023-01-25 11:19:58 +01:00
Marko Gaćeša
5524dfa9ba Renamed branchmonitor to service/pullreq (#234) 2023-01-19 17:53:37 +01:00
Johannes Batzill
43c497f59c [MISC] Move webhooks to 'services' package (#232) 2023-01-18 19:08:03 -08:00
Johannes Batzill
335998505e [MISC] Introduce PathStore and Move PathLogic to Controller Layer (#226)
This change is a follow up on the effort to remove transactions and sync stores from the database layer, and move them in the application layer. It is addressing the repo + space store.
The following changes are included:
- Introduce PathStore storing resource paths (repo + space)
- Add foreign key from path.repo_id/space_id to repo.id/space.id
- Add foreign key from repo/space.parent_id to space.id
- Remove repo_sync and space_sync
- Move path creation logic to repo/space controller (for both creating primary paths for new repos/spaces, as well as creating alias spaces)
- Reimplement repo/space moving on controller layer
2023-01-18 11:34:12 -08:00
Marko Gaćeša
ec4003e331 Handling branch events for PRs (#221) 2023-01-18 13:26:20 +01:00
Johannes Batzill
155563615b [MISC] Minor Cleanup in types + enum Package (#186) 2023-01-11 23:16:07 -08:00
Marko Gaćeša
24e03c03e0 Added principal info cache (#173)
* added principal info cache

* updated code based on the PR comments

* updated implementation of deduplicate()

* minor changes

* [K, T] -> [K, V]
2023-01-11 20:32:37 +01:00
Johannes Batzill
d1dd518b3f add commit details to webhook payload (#175) 2023-01-11 10:51:28 -08:00
Johannes Batzill
a426cdd69b [GIT] Add Support for Other Git Clients (#171) 2023-01-10 14:35:09 -08:00
Enver Bisevac
63de576d08 [feat] initial work on merging PR (#170)
* initial work on merging PR

* code refactored based on requested changes

* requested changes
2023-01-10 02:09:43 +01:00
Johannes Batzill
5cb824debd [feat]: Add Git Server Hook Support (#159)
This change is adding git server hook components:
- githook CLI implementation
- githook api handlers
- githook controler
2023-01-06 12:15:11 -08:00
Marko Gaćeša
65b49a933a pull request reviewers (#167) 2023-01-06 20:29:20 +01:00
Johannes Batzill
2006f769c9 [Webhook] Add url.Provider, Add principal to branch webhooks (#163) 2023-01-06 01:57:26 -08:00
Johannes Batzill
06721dcf20 [Techdebt] merge user/service/serviceaccount stores into single principal store (#160)
This change merges the `UserStore`, `ServiceStore`, and `ServiceAccountStore` into a single `PrincipalStore`.
2023-01-05 15:58:18 -08:00
Johannes Batzill
6c567b38d0 [MISC] Move GitRPC to Read/WriteRequest, Update Create/Delete Branch to use Push, Setup githook Symlink, Accept Incoming X-Request-Id (#157) 2023-01-05 11:03:35 -08:00
Johannes Batzill
1f1118f624 [Webhook] Add Event Processing and Retrigger (#148)
This change includes:
- webhook event processor (includes actual webhook execution)
- webhook retrigger API allowing to retrigger previous webhook executions
2023-01-04 14:43:36 -08:00
Johannes Batzill
c30beb34ac [Harness] Add user self API (#147)
This change is adding the following:
- Global HarnessContext injection
- Block API KEY authentication for global context (They are tied to accounts)
- /user API endpoint for embedded mode
2022-12-29 16:01:14 -08:00
Marko Gaćeša
a79e187a88 DB & API refactor: Use snake case (#144)
Update DB and API to follow Harness Standard
2022-12-29 13:53:08 -08:00
Johannes Batzill
44ec7ceb07 [Webhook] Add API and DB Basics (#142)
This change introduces:
- webhook type / store / controller / handler
- webhookExecution type / store / controller / handler
- foreign key fix for sqlite3
2022-12-28 13:07:48 -08:00
Marko Gaćeša
7fc77396a9 Pull request timeline feature: DB and the list API (#136) 2022-12-26 12:17:38 +01:00
Johannes Batzill
7abcacdd2f feat: Add Events Framework (#120)
This Commit adds:
- stream package (provides different implementation of stream producers and consumers)
  + Redis -> will be used for any non-local deployments
  + InMemory -> a VERY BASIC implementation that is used for local execution
- events package
  + GenericReporter -> responsible for reporting events, can be used to send any type of event and payload
  + GenericReader -> responsible for reading events from a stream, can be used to register handlers for any type of event and payload
  + ReaderFactory -> responsible for launching readers for any type of consumer group&name.
- webhook package
  + The wire frame of the webhook package.
- gitrpc/events package
  + defines event Reader/Reporter for events of category git
2022-12-16 13:37:08 -08:00
Johannes Batzill
3b120dd2b3 Add Zerolog Support to GITRPC (#126)
This change adds the following:
- Inject APP server zerolog RequestID as metadata into all gitrpc calls from client side.
- Inject Zerolog logger into context with common fields set (like service, method, requestID, ...). This allows for better request tracking within gitrpc, but also request tracking across services we extract the requestID send by the grpc client
- Modify http logs to use http. prefix for common http related logging annotations.
2022-12-16 08:39:10 -08:00
Shubham Banthia
c6e178c71c adding server hook implementation for post and pre receive (#109)
* adding server hook implementation for post and pre receive

* addressing comments

* update logging

* updating import order

* adding file header for license
2022-12-02 13:25:53 -08:00
Enver Bisevac
7a54ef9d65 fix with file content on commit, fix linter, removed unused provider 2022-11-30 22:36:01 +01:00
Shubham Banthia
c7df722c8a adding server side hook for update (#94)
* adding server side hook for update

* addressing comments

* update comments for command
2022-11-29 19:51:08 -08:00
Marko Gaćeša
1eba93695b feat: pull requests (#89)
* feat: pull requests, data layer

* pull requests: api layer

* add pull request number

* added auth check
2022-11-29 13:51:59 +01:00
Enver Bisevac
630c9b553f ordering imports linter and writer (#85) 2022-11-22 23:42:39 +01:00
Enver Bisevac
ad619c7e3c [feat]ability to commit files using REST api (#82)
* initial work on commit files

* minor improvements, grpc server interceptors and more

* compare file old sha and current sha

* added some validation steps

* config immutable, introduce temp repos dir

* handler added to standalone

* fix CI linter, fix minor bug on update

* wire generator files
2022-11-22 19:24:40 +01:00
Enver Bisevac
93fc430776 [bug] git clone/pull/push auth using Basic Authorization fixed (#66)
* git clone/pull/push auth using Basic Authorization fixed

* use api key as git login

* middleware renamed to RequiredInGitPath

* remove requiredingitpath middleware

* requested changes

* requested changes

* minor code cleanup
2022-11-11 07:59:32 +01:00
Johannes Batzill
c8cee4d250 [Misc] Preparation for Container Deployment (#67)
This change is fixing our docker file which is used to build our harness code image used for PR deployments.
Furthermore, the change contains some logging improvements that were added along the way of setting up the PR environment.
2022-11-09 23:03:40 -08:00
Johannes Batzill
ff2f949e78 add GITURL to repo apis list and create (#64)
- rename repo.url to repo.GitURL to avoid ambiguity
- add support to create / list api
- add default value (http://localhost:3000)
- remove handler backfilling host / port to simplify flow (can be added if needed)
2022-11-08 19:35:49 -08:00
Enver Bisevac
98436fb644 clone url implemented (#63)
Clone URL (http) used for clone/pull/push git operations
2022-11-08 18:32:01 -08:00
Johannes Batzill
3ba0f75c8d Introduce UIDs for Space / Repo / Tokens, Add Custom Harness Validation, ... (#57)
This change adds the following:
- Space UID + Custom harness validation (accountId for top level space, harness identifier for child spaces)
- Repo UID + Custom harness validation (harness identifier)
- Store Unique casing of space / repo path and add Path.ValueUnique (with Unique index) to allow for application layer controlling the case sensitivity (case insensitive standalone vs partially case sensitive harness)
- Token UID (unique index over ownertype + ownerID + tokenUID)
- Add DisplayName for principals (replaces Name to avoid confustion)
- Store Unique casing of principal UID and add Principal.ValueUnique (with unique index) to allow for application layer, per principal type control of case sensitivity (required in embedded mode)
- Generate serviceAccount UID (+Email) Randomly (sa-{space|repo}-{ID}-{random}) - Allows to have a unique UID across all principals while reducing likelyhood of overlaps with users + avoid overlap across spaces / repos.
- Sync casing of space names (accountId orgId projectId) when creating spaces on the fly (to ensure case sensitivity of - harness code) or use the existing space to update casing.
- Update serviceaccount client to match updated NG Manager API
- in embedded mode create spaces for harness resources owning the service account
2022-11-06 23:14:47 -08:00
Enver Bisevac
20860ef399 [maint] app refactor, use proper package names (#53)
* app refactor, use proper package names

* minor changes

* use fat client interface, minor change on session

* initialize session and http client
2022-11-04 08:25:13 +01:00
Enver Bisevac
578dd13d8d [maint] eb/gitrpc refactor (#51)
* pull/push impl done

* Basic auth for harness

* gitrpc as top level package

* New ctor for package

* gitrpcserver instead of server2
2022-11-03 13:17:03 +01:00
Enver Bisevac
fb0e93394d [feat] pull/push over https - done (#47)
* pull/push impl done

* Basic auth for harness
2022-11-01 19:02:29 +01:00
Johannes Batzill
2d897c4486 [MAINT] Add PAT CLI command and update readme (#45)
Add PAT CLI command and update readme
2022-10-24 22:50:33 -07:00
Johannes Batzill
f655c2fae3 Add Standalone API to Harness Router (#40)
To simplify UI code we are going to expose both Harness API and Standalone API (restricted to harness embedded functionalities) when running in harness mode.

Furthermore, this PR adds a middleware that allows us to reuse standalone Handlers for Harness API for operations that don't require any request/response manipulation.
2022-10-19 18:35:40 -07:00
Johannes Batzill
e423ffda3c Fix Default Branch Creation (#37)
While the HEAD is pointed to the correct branch (might not exist), we created the initial files during repo creation still on the master branch (as it's an empty repo and clone by default sets up master when cloning an empty repo)
2022-10-17 19:09:46 -07:00
Johannes Batzill
7317ec9d62 Remove types dependency from gitrpc package, add back commits/content api (#36) 2022-10-17 17:12:52 -07:00
Johannes Batzill
91a75ed601 Add GetContent and ListCommits APIs, Fix DefaultBranch support (#32)
Adds the following:
- Add GetContent API (with gitrpc, proto, gitadapter changes)
- Add ListCommits API (with gitrpc, proto, gitadapter changes)
- DefaultBranch (to repo table in DB, update branch in git-repo, have default value in config)
2022-10-17 00:14:31 -07:00
Enver Bisevac
00647d7d1b [MAINT] golangci-lint config changed (#31)
* goheader linter added

* file header consistency
2022-10-13 14:39:15 +02:00
Johannes Batzill
ecb6276fa8 Add EOF to RPC File Chunk & Cleanups (#29)
Adds an EOF flag to data chunks to avoid using []byte("EOF") as end (due to potential false positives).
Furthermore, a few cleanups are done:
- Add TODOs for initial git changes
- Add missing file headers
- Fix typo for license (was licence)
- Fix make wire target
2022-10-12 10:21:53 -07:00
Enver Bisevac
1cf07b6417 initial work on create repository (#27)
* initial work on create repository

* create repository as single method call using client stream

* resources handler and files

* minor fix for wire dep graph
2022-10-11 17:48:04 +02:00
Johannes Batzill
5786ad2409 [Embedded] Harness Router, Inline Space Creation, Bootstrap, Harness/Admin User Setup (#28)
Adds the basic for harness embedded mode:
- Harness dedicated router with custom APIHandler
- Inline Space Creation
- Client for Account/Org/Project
- Bootstrap (Allows for automated creation of admin user and gitness service (used for all platform required ops))
- Inline harness service principal creation
- Ignore flag for ACL.
2022-10-10 21:32:14 -07:00
Johannes Batzill
c07dc4c779 Remove translator (#26)
Simplify the router code by removing the translator. Now that we have Api/Git/WebHandler interfaces, they can be wrapped in handlers to do any custom request translation.
2022-10-04 10:16:26 -07:00
Johannes Batzill
fad6e18898 Introduce Controller for Repo, Space, User, and ServiceAccount (#25)
Preparing the support for harness specific API router + http handler, which allows us to have complete control over the rest api naming and functionality, without having to do complex path rewrites or request / reponse rewrites inline.
2022-10-03 18:56:49 -07:00
Johannes Batzill
4d3db64397 add specific handlers for api/git/web to allow replacement for harness (#23)
Abstracting the api/git/web routers will allow us to replace API routing (and potentially web?), while keeping the rest the same.
2022-09-30 17:05:39 -07:00
Johannes Batzill
4668e94027 [Harness] Adding JWT/PAT/SAT Support, Harness Clients, Inline User/ServiceAccount Creation, harness Build flag, ... (#22)
This change adds the initial stepping stones for harness integration:
- Authentication: JWT/PAT/SAT support
- Authorization: ACL integration (acl currently denies requests as gitness hasn't been integrated yet)
- Remote Clients for Token, User, ServiceAccount, ACL
- User Integration: Syncs harness users during authentication if unknown
- SA integration: syncs harness service accounts during authentication if unknown
- Initial harness API: THIS WILL BE CHANGED IN THE FUTURE!
- single harness subpackage (all marked with harness build flag)
- harness & standalone wire + make build commands
2022-09-30 16:22:12 -07:00
Johannes Batzill
5baf42d5ca Add context to pingDatabase and change logging behavior (#21)
Add cancelable context to our server CLI and adds canceling and improved logging to PingDatabase
2022-09-27 09:45:52 -07:00
Johannes Batzill
8c2f900c80 Principals, ServiceAccounts, Tokens and auth.Sessions (#15)
This change introduces the concept of a principal (abstraction of call identity), and adds a new service account type principal. Also adds support for different tokens (session, PAT, SAT, OAuth2) and adds auth.Session which is being used to capture information about the caller and call method.
2022-09-25 23:44:51 -07:00
Enver Bisevac
78d5794221 makefile build rule modified, ioutil deprecated removed 2022-09-22 16:27:46 +02:00
Enver Bisevac
f03528e862 [MAINT] initial config for ci linter (#17)
* initial config for ci linter

* more linter work

* linter errors fix

* linter errors fix

* linter conf minor changes
2022-09-19 18:13:18 +02:00
Enver Bisevac
ca8aa47e05 [MAINT] initial work on linter setup (#16)
* initial work on linter setup

* simple linter rules fixed
2022-09-13 00:08:43 +02:00