Commit Graph

546 Commits (main)

Author SHA1 Message Date
Marko Gaćeša f14731455d Add parent_id column to the pullreq_activities DB table (#143) 2022-12-28 18:51:34 +01:00
Marko Gaćeša da53331ca1 PR comment: edit and delete APIs (#138) 2022-12-27 14:55:53 +01:00
Marko Gaćeša b5bdeb8538 create comment API (#137) 2022-12-27 11:46:49 +01:00
Marko Gaćeša 7fc77396a9 Pull request timeline feature: DB and the list API (#136) 2022-12-26 12:17:38 +01:00
Marko Gaćeša 8f5e579001 rename DB table pullreq to pullreqs; added version (#130) 2022-12-22 20:21:15 +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
Marko Gaćeša 6bde210adf added branch params to PR list API (#119) 2022-12-09 15:45:02 +01:00
Marko Gaćeša 15163f3daa pullreq: dedicated struct for pulling data from DB (#116) 2022-12-08 12:52:31 +01:00
Marko Gaćeša 9e86875217 Returning author and merger info for PRs (#114) 2022-12-07 14:03:17 +01:00
Marko Gaćeša 1f4ac7e4b4 pullreq: list API (#99) 2022-11-30 13:56:29 +01: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
Johannes Batzill c55c53deab [API] Add Create + Delete Branch API (+ Basic GIT Error Propagation) (#70)
This change adds the following:
- create / delete branch
- basic error propagation from git to user (notfound, conflict, invalidinput)
- create repo root folder in server instead of service constructor
2022-11-10 20:57:31 -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 8fe80ab811 Remove `Identifier` from UI - Replace with original `Name` (#59)
* remove identifier from UI and replace it with original 'Name'
* extend uid to length 100
* allow repo name of length 1
2022-11-07 14:37:50 -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 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 2d4db78991 Add Tag Listing API (#49)
This change is adding the List Tags API. To do so, a few changes were necessary:
- Refactor List Branches on giteaAdapter / repo_service
- Expose WalkReferences via giteaAdapter
2022-10-28 13:10:26 -07: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 c0258b34ef Add search capability to repo and space listing (for child spaces) (#44)
This change is adding search capability to the following apis:
- child repositories
- child spaces
*NOTE* The search space is limited to direct child repos/spaces.
2022-10-24 18:57:55 -07:00
Johannes Batzill 5337c46a4f Add Query and Sorting Capability to ListBranches API (#42)
This change adds the following to the list branches api:
- 'query' parameter for querying branches using arbitrary substrings
- 'sort' parameter for sorting the branches (name and date supported)
- 'direction' parameter for specifing the direction of the sorted output
2022-10-21 20:45:26 -07:00
Johannes Batzill 743aee6029 [API] Add List Branches, Improve latestCommit Performance for listing directory (#38)
This commit has the following changes:
- API for listing branches
- Improve performance of content API for dir type responses with includeCommit=true
- swagger for git operations
- fix file names from camelCase to kebab_case
2022-10-17 23:05:50 -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 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 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 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 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 560c08dcca [MAINT] fix linter errors. (#18)
* fix linter errors

* fix exhaust linter error

* fix exhaust linter error
2022-09-21 19:49:14 +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
Johannes Batzill b7b9f53b0d Improve error handling to match go standards - don't wrap and rethrow, but log and return. Also adds some more validations for path creation and resource moving. Add accesslogging for git and api router (#14)
This commit contains the following:
- Improve and simplify error handling (remove unnecessary wrappers, make it feel like go)
- Add extra validation for path creation and resource moving (path has to be within same top space, no top space alias allowed)
- Add access logging for rest api and git api
2022-09-09 22:08:46 -07:00
Johannes Batzill 4812beedc6 Enforce max path length on store layer to avoid racing condition, (#12)
Add enforcement of the path length to the store layer before writing the path, move errs to internal, and adds a comms package under internal/api.
2022-09-09 00:45:41 -07:00
Johannes Batzill 1115a5083b Add `Paths` support and error improvements (#11)
This change is adding the concept of Paths.
A repository and space always have a Primary Path which always is represents the ancestry to the root space.
All access history / resource visibility / child listings / UI traversal / etc. is done via that path.

Additionally, repos and spaces can have Alias Paths, which as the name states are aliases. via the primary path.
They sole impact is that a space or repo can be reached via different paths from the UI / rest apis / git apis.
This fulfills two major purposes:
- Customers can rename or move projects and spaces without breaking any existing references from CI pipeliens / code bases / local repos / ...
- Customer can create shorter aliases for important repos when in harness embeded mode! (acc/org/proj/repo can be shortened to acc/repo, or acc/repo'

Apart from the path changes, this PR adds:

Improved User facing errors
Improved internal error handling and wrapping
update / rename operation for repo and space
path list / delete / create operation for repo and space
2022-09-08 21:39:15 -07:00
Johannes Batzill 1db4fc9c8d Change create API for space/repo to follow REST best practices (#10)
Move repo and space create apis to /api/v1/repos/ and /api/v1/spaces/ and take name and parentId in body.
2022-09-06 20:36:34 -07:00
Johannes Batzill 3b6f6b8916 Add proper scoping to authorization code 2022-09-05 22:17:16 -07:00
Johannes Batzill ff806fb492 block 'api' as root space name, minor improvements 2022-09-05 18:45:16 -07:00
Johannes Batzill d7f0ae4b2c Add base structure for rest api, git api, web api. Add base authn and authz, as well as spaces and repository apis 2022-09-05 13:47:00 -07:00
Johannes Batzill 32e6c4929f Add authn, authz, spaces, guard, terminated FQNs 2022-09-05 13:47:00 -07:00
Johannes Batzill 4cd1ecebf1 Remove unnecessary types 2022-09-05 13:47:00 -07:00
Johannes Batzill 4aa8819765 Rename project to 'gitness' 2022-08-29 10:12:07 -07:00
Johannes Batzill 813d343f6a Rename module to github.com/harness/scm. Fix web/dist.go 2022-08-18 15:15:50 -07:00
Tan Nhu 5891818ce1 Initial commit 2022-08-09 12:37:37 -07:00