
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
2.9 KiB
Pre-Requisites
Install the latest stable version of Node and Go version 1.19 or higher, and then install the below Go programs. Ensure the GOPATH bin directory is added to your PATH.
$ make all
Setup github access token required for UI dependencies:
$ yarn setup-github-registry
Build
Build the user interface:
$ pushd web
$ yarn install
$ yarn run build
$ popd
Build the server and command line tools:
# STANDALONE
$ make build
Test
Execute the unit tests:
$ make test
Run
This project supports all operating systems and architectures supported by Go. This means you can build and run the system on your machine; docker containers are not required for local development and testing.
Start the server at localhost:3000
# STANDALONE
./gitness server .local.env
User Interface
This project includes a simple user interface for interacting with the system. When you run the application, you can access the user interface by navigating to http://localhost:3000
in your browser.
Swagger
This project includes a swagger specification. When you run the application, you can access the swagger specification by navigating to http://localhost:3000/swagger
in your browser.
CLI
This project includes simple command line tools for interacting with the system. Please remember that you must start the server before you can execute commands.
Register a new user:
$ ./gitness register
NOTE: A user
admin
(pw:changeit
) gets created by default.
Login to the application:
$ ./gitness login
Logout from the application:
$ ./gitness logout
View your account details:
$ ./gitness user self
Generate a personal access token:
$ ./gitness user pat $UID $LIFETIME_IN_S
Debug and output http responses from the server:
$ DEBUG=true ./gitness user self
View all commands:
$ ./gitness --help
REST API
Please refer to the swagger for the specification of our rest API.
For testing, it's simplest to execute operations as the default user admin
using a PAT:
# LOGIN (user: admin, pw: changeit)
$ ./gitness login
# GENERATE PAT (1 YEAR VALIDITY)
$ ./gitness user pat mypat 2592000
The command outputs a valid PAT that has been granted full access as the user.
The token can then be send as part of the Authorization
header with Postman or curl:
$ curl http://localhost:3000/api/v1/user \
-H "Authorization: Bearer $TOKEN"