### Start Development Server Source: https://github.com/goharbor/harbor/blob/main/src/portal/README.md Starts the development server for the Harbor UI application. ```bash npm run start ``` -------------------------------- ### Start Application Source: https://github.com/goharbor/harbor/blob/main/src/portal/server/README.md Run this command after configuring the proxy to start your application. All mocked APIs will be redirected to the mocked server. ```shell npm run start ``` -------------------------------- ### Start Mock API Server Source: https://github.com/goharbor/harbor/blob/main/src/portal/server/README.md Navigate to the 'portal' directory and run this command to start the mock API server. ```shell npm run mock-api-server ``` -------------------------------- ### Run E2E Setup Source: https://github.com/goharbor/harbor/blob/main/tests/e2e_setup/README.md Execute the initial setup script for the end-to-end tests using the configured robot variables file. ```bash robot -V /drone/tests/e2e_setup/robotvars.py /drone/tests/robot-cases/Group1-Nightly/Setup_Nightly.robot ``` -------------------------------- ### Example API Client Method Source: https://github.com/goharbor/harbor/blob/main/src/portal/server/README.md This TypeScript method demonstrates how to make an HTTP GET request to fetch scanner data. ```typescript getScannersByName(name: string): Observable { name = encodeURIComponent(name); return this.http.get(`/api/scanners?ex_name=${name}`) .pipe(catchError(error => observableThrowError(error))) .pipe(map(response => response as Scanner[])); } ``` -------------------------------- ### Install Development Tools Source: https://github.com/goharbor/harbor/blob/main/CONTRIBUTING.md Install the necessary tools, fgt and golint, for code formatting and linting. These tools help maintain code quality and consistency. ```sh #Install fgt and golint go install golang.org/x/lint/golint@latest go install github.com/GeertJohan/fgt@latest ``` -------------------------------- ### Install and Use Node Version Source: https://github.com/goharbor/harbor/blob/main/src/portal/README.md Installs and switches to the Node.js version specified in the .nvmrc file for dependency compatibility. ```bash nvm install # Install the Node version from .nvmrc (if not already installed) nvm use # Switch to the specified Node version ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/goharbor/harbor/blob/main/src/portal/README.md Installs all necessary project dependencies using npm. This command may also trigger a postinstall script. ```bash npm install ``` -------------------------------- ### Install Cosign Source: https://github.com/goharbor/harbor/blob/main/docs/signature-verification.md Installs the Cosign tool, which is required for signature verification. Choose the command appropriate for your operating system. ```bash # macOS brew install sigstore/tap/cosign ``` ```bash # Linux curl -LO https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64 chmod +x cosign-linux-amd64 sudo mv cosign-linux-amd64 /usr/local/bin/cosign ``` ```powershell # Windows (PowerShell) Invoke-WebRequest -Uri "https://github.com/sigstore/cosign/releases/latest/download/cosign-windows-amd64.exe" -OutFile "cosign.exe" ``` ```bash # Verify installation cosign version ``` -------------------------------- ### Main Server Setup Source: https://github.com/goharbor/harbor/blob/main/tools/swagger/templates/README.md Initiates business logic implementers, configures the REST API handler, and runs the HTTP server. Dependencies for business logic can be injected here. ```go func main() { // Initiate business logic implementers. // This is the main function, so here the implementers' dependencies can be // injected, such as database, parameters from environment variables, or different // clients for different APIs. p := internal.Pet{} s := internal.Store{} // Initiate the http handler, with the objects that are implementing the business logic. h, err := restapi.Handler(restapi.Config{ PetAPI: &p, StoreAPI: &s, Logger: log.Printf, }) if err != nil { log.Fatal(err) } // Run the standard http server log.Fatal(http.ListenAndServe(":8080", h)) } ``` -------------------------------- ### Install Helm Chart from OCI Registry Source: https://github.com/goharbor/harbor/wiki/Migrate-helm-chart-to-oci-registry-in-Harbor Verify successful migration by installing a Helm chart from the OCI registry in Harbor. This command assumes the chart has been successfully pushed. ```bash helm install myrelease oci://// --version ``` -------------------------------- ### Logger Configuration Example Source: https://github.com/goharbor/harbor/blob/main/src/jobservice/README.md This YAML configuration demonstrates how to set up loggers for the job service and running jobs. It includes examples for STD_OUTPUT, FILE, and DB loggers, specifying levels, settings, and sweeper durations. ```yaml #Loggers loggers: - name: "STD_OUTPUT" # logger backend name, only support "DB", "FILE" and "STD_OUTPUT" level: "DEBUG" # INFO/DEBUG/WARNING/ERROR/FATAL - name: "FILE" level: "DEBUG" settings: # Customized settings of logger base_dir: "/tmp/job_logs" sweeper: duration: 1 #days settings: # Customized settings of sweeper work_dir: "/tmp/job_logs" - name: "DB" level: "DEBUG" sweeper: duration: 1 #days ``` -------------------------------- ### Copy Trivy DB to Harbor Installer (v0.22.0-) Source: https://github.com/goharbor/harbor/wiki/Harbor-FAQs These commands copy the downloaded Trivy vulnerability database to the correct cache directory for a Harbor installation using the installer. It involves using Docker to execute commands within the trivy-adapter container. ```bash $ docker exec -u scanner trivy-adapter mkdir -p /home/scanner/.cache/trivy/db/ $ docker cp metadata.json trivy-adapter:/tmp/metadata.json $ docker cp trivy.db trivy-adapter:/tmp/trivy.db $ docker exec -u scanner trivy-adapter cp /tmp/metadata.json /home/scanner/.cache/trivy/db/metadata.json $ docker exec -u scanner trivy-adapter cp /tmp/trivy.db /home/scanner/.cache/trivy/db/trivy.db ``` -------------------------------- ### Download and Verify Online Installer Signature Source: https://github.com/goharbor/harbor/blob/main/docs/signature-verification.md Downloads the Harbor online installer and its signature, then verifies the signature using Cosign. This process confirms the authenticity and integrity of the online installer. ```bash wget https://github.com/goharbor/harbor/releases/download/v2.15.0/harbor-online-installer-v2.15.0.tgz wget https://github.com/goharbor/harbor/releases/download/v2.15.0/harbor-online-installer-v2.15.0.tgz.sigstore.json cosign verify-blob \ --bundle harbor-online-installer-v2.15.0.tgz.sigstore.json \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-identity-regexp '^https://github.com/goharbor/harbor/.github/workflows/publish_release.yml@refs/tags/v.*$' \ harbor-online-installer-v2.15.0.tgz ``` -------------------------------- ### Download Offline Installer and Signature Source: https://github.com/goharbor/harbor/blob/main/docs/signature-verification.md Downloads the Harbor offline installer and its corresponding signature file. Ensure both files are in the same directory for verification. ```bash # Download installer and Signature file (example v2.15.0) wget https://github.com/goharbor/harbor/releases/download/v2.15.0/harbor-offline-installer-v2.15.0.tgz wget https://github.com/goharbor/harbor/releases/download/v2.15.0/harbor-offline-installer-v2.15.0.tgz.sigstore.json ``` -------------------------------- ### Start E2E Container Source: https://github.com/goharbor/harbor/blob/main/tests/e2e_setup/README.md Initiate the end-to-end testing container. Ensure the harbor_ca.crt file is present in the /ca directory; copy it if necessary. ```bash ./e2e_container.sh cp /ca/ca.crt /ca/harbor_ca.crt ``` -------------------------------- ### Fetch PostgreSQL Configuration Source: https://github.com/goharbor/harbor/wiki/Harbor-FAQs Retrieves the postgresql.conf file from the database pod when Harbor is installed by Helm. ```shell NAMESPACE=the-namespace-of-harbor POD_NAME=`kubectl -n $NAMESPACE get pod -l "component=database,app=harbor" -o name` kubectl -n $NAMESPACE exec $POD_NAME -- cat /var/lib/postgresql/data/postgresql.conf > postgresql.conf ``` -------------------------------- ### Job Service Configuration Sample Source: https://github.com/goharbor/harbor/blob/main/src/jobservice/README.md This sample YAML configuration illustrates the overall setup for the Job Service, including protocol, ports, worker pool settings, and logger configurations for both the service and running jobs. ```yaml --- #Protocol used to serve protocol: "https" #Config certification if use 'https' protocol https_config: cert: "server.crt" key: "server.key" #Server listening port port: 9443 #Worker pool worker_pool: #Worker concurrency workers: 10 backend: "redis" #Additional config if use 'redis' backend redis_pool: #redis://[arbitrary_username:password@]ipaddress:port/database_index #or ipaddress:port[,weight,password,database_index] redis_url: "localhost:6379" namespace: "harbor_job_service" #Loggers for the running job job_loggers: - name: "STD_OUTPUT" # logger backend name, only support "DB", "FILE" and "STD_OUTPUT" level: "DEBUG" # INFO/DEBUG/WARNING/ERROR/FATAL - name: "FILE" level: "DEBUG" settings: # Customized settings of logger base_dir: "/tmp/job_logs" sweeper: duration: 1 #days settings: # Customized settings of sweeper work_dir: "/tmp/job_logs" - name: "DB" level: "DEBUG" sweeper: duration: 1 #days #Loggers for the job service loggers: - name: "STD_OUTPUT" # Same with above level: "DEBUG" ``` -------------------------------- ### Copy and Modify Nginx Configuration Source: https://github.com/goharbor/harbor/blob/main/src/portal/docker-build/README.md Copy the example Nginx configuration file and update it to point to a valid backend server address. ```bash cp nginx.conf.example nginx.conf ``` ```nginx location ~ ^/(api|c|chartrepo)/ { proxy_pass ${an available back-end server addr}; } ``` -------------------------------- ### Development Server Start Script Source: https://github.com/goharbor/harbor/blob/main/src/portal/PACKAGE.md Starts the Angular development server with SSL enabled, listening on all network interfaces. It uses a proxy configuration file and allows for a large memory allocation for the Node.js process. ```json "start": "node --max_old_space_size=2048 ./node_modules/@angular/cli/bin/ng serve --ssl true --host 0.0.0.0 --proxy-config proxy.config.json" ``` -------------------------------- ### Build the Chart Migrating Tool Image Source: https://github.com/goharbor/harbor/blob/main/tools/migrate_chart/Readme.md Builds the Docker image for the chart migrating tool. Ensure you have Docker installed and running. ```sh docker build -t goharbor/migrate-chart:0.1.0 . ``` -------------------------------- ### Install Harbor Helm Chart Source: https://github.com/goharbor/harbor/blob/main/src/pkg/chart/testdata/harbor-schema1/README.md Installs the Harbor Helm chart with a specified release name. This command deploys Harbor into your Kubernetes cluster using the default configuration. ```bash helm install my-release harbor/harbor ``` -------------------------------- ### Angular CLI Production Start Script Source: https://github.com/goharbor/harbor/blob/main/src/portal/PACKAGE.md Starts the Angular CLI development server in production configuration with SSL and proxy settings. ```json "start:prod": "node --max_old_space_size=2048 ./node_modules/@angular/cli/bin/ng serve --ssl true --host 0.0.0.0 --proxy-config proxy.config.json --configuration production" ``` -------------------------------- ### Start Harbor Containers Source: https://github.com/goharbor/harbor/blob/main/contrib/deploying_using_docker_machine.md Starts the Harbor containers in detached mode using Docker Compose. This command should be run from within the Harbor deploy directory. ```bash $ docker-compose up -d ``` -------------------------------- ### Manually Trigger Postinstall Script Source: https://github.com/goharbor/harbor/blob/main/src/portal/README.md Manually runs the postinstall script if it was not automatically triggered by 'npm install'. ```bash npm run postinstall ``` -------------------------------- ### Run Job Service Source: https://github.com/goharbor/harbor/blob/main/src/jobservice/README.md Start the job service by providing the path to its configuration YAML file. Ensure the CORE_SECRET environment variable is exported. ```shell jobservice -c ``` -------------------------------- ### Get Service Health Status Response Source: https://github.com/goharbor/harbor/blob/main/src/jobservice/README.md This JSON array indicates the health status of worker pools, including their ID, start time, heartbeat, job names, concurrency, and overall status. ```json [ { "worker_pool_id": "pool1", "started_at": 1539164886, "heartbeat_at": 1539164986, "job_names": ["DEMO"], "concurrency": 10, "status": "healthy" } ] ``` -------------------------------- ### Set Up Go Environment and Clone Harbor Repository Source: https://github.com/goharbor/harbor/blob/main/CONTRIBUTING.md Configure your Go environment and clone the Harbor repository. Remember to replace '$USER' with your GitHub username. ```sh #Set golang environment export GOPATH=$HOME/go mkdir -p $GOPATH/src/github.com/goharbor #Get code cd $GOPATH/src/github.com/goharbor/harbor git clone git@github.com:goharbor/harbor.git #Track repository under your personal account git config push.default nothing # Anything to avoid pushing to goharbor/harbor by default git remote rename origin goharbor git remote add $USER git@github.com:$USER/harbor.git git fetch $USER ``` -------------------------------- ### Demo Job Implementation Source: https://github.com/goharbor/harbor/blob/main/src/jobservice/README.md Provides a sample implementation of the Job interface, demonstrating methods for retry logic, validation, and execution. ```go import ( "errors" "fmt" "strings" "time" "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/jobservice/errs" "github.com/goharbor/harbor/src/jobservice/job" opm "github.com/goharbor/harbor/src/jobservice/opm" ) // DemoJob is the job to demonstrate the job interface. type DemoJob struct{} // MaxFails is implementation of same method in Interface. func (dj *DemoJob) MaxFails() uint { return 3 } // MaxCurrency is implementation of same method in Interface. func (dj *DemoJob) MaxCurrency() uint { return 1 } // ShouldRetry ... func (dj *DemoJob) ShouldRetry() bool { return true } // Validate is implementation of same method in Interface. func (dj *DemoJob) Validate(params job.Parameters) error { if len(params) == 0 { return errors.New("parameters required for replication job") } name, ok := params["image"] if !ok { return errors.New("missing parameter 'image'") } if !strings.HasPrefix(name.(string), "demo") { return fmt.Errorf("expected '%s' but got '%s'", "demo *", name) } return nil } // Run the replication logic here. func (dj *DemoJob) Run(ctx job.Context, params job.Parameters) error { logger := ctx.GetLogger() defer func() { logger.Info("I'm finished, exit!") fmt.Println("I'm finished, exit!") }() fmt.Println("I'm running") logger.Info("=======Replication job running=======") logger.Infof("params: %#v\n", params) logger.Infof("context: %#v\n", ctx) if v, ok := ctx.Get("email_from"); ok { fmt.Printf("Get prop form context: email_from=%s\n", v) } if u, err := dao.GetUser(models.User{}); err == nil { fmt.Printf("u=%#+v\n", u) } /*if 1 != 0 { return errors.New("I suicide") }*/ // runtime error // var runtime_err error = nil // fmt.Println(runtime_err.Error()) logger.Info("check in 30%") ctx.Checkin("30%") time.Sleep(2 * time.Second) logger.Warning("check in 60%") ctx.Checkin("60%") time.Sleep(2 * time.Second) logger.Debug("check in 100%") ctx.Checkin("100%") time.Sleep(1 * time.Second) // HOLD ON FOR A WHILE logger.Error("Holding for 20 sec") <-time.After(15 * time.Second) // logger.Fatal("I'm back, check if I'm stopped/cancelled") if cmd, ok := ctx.OPCommand(); ok { logger.Infof("cmd=%s\n", cmd) fmt.Printf("Receive OP command: %s\n", cmd) if cmd == opm.CtlCommandCancel { logger.Info("exit for receiving cancel signal") return errs.JobCancelledError() } logger.Info("exit for receiving stop signal") return errs.JobStoppedError() } fmt.Println("I'm close to end") return nil } ``` -------------------------------- ### Define Local Working Directory Source: https://github.com/goharbor/harbor/blob/main/CONTRIBUTING.md Set up your local workspace according to Go's conventions. Ensure the path is correctly defined before proceeding. ```sh working_dir=$GOPATH/src/github.com/goharbor ``` -------------------------------- ### Install Git Commit Hook Source: https://github.com/goharbor/harbor/blob/main/CONTRIBUTING.md Download and install the git-good-commit hook script to help enforce conformant commit messages. ```sh curl https://cdn.jsdelivr.net/gh/tommarshall/git-good-commit@v0.6.1/hook.sh > .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg ``` -------------------------------- ### Copy Trivy DB to Harbor Offline Installer (v0.23.0+) Source: https://github.com/goharbor/harbor/wiki/Harbor-FAQs These commands copy the downloaded Trivy vulnerability database to the correct cache directory for a Harbor installation using the offline installer. It involves using Docker to execute commands within the trivy-adapter container. ```bash docker exec -u scanner trivy-adapter mkdir -p /home/scanner/.cache/trivy/db/ docker cp $TRIVY_TEMP_DIR/db/metadata.json trivy-adapter:/tmp/metadata.json docker cp $TRIVY_TEMP_DIR/db/trivy.db trivy-adapter:/tmp/trivy.db docker exec -u scanner trivy-adapter cp /tmp/metadata.json /home/scanner/.cache/trivy/db/metadata.json docker exec -u scanner trivy-adapter cp /tmp/trivy.db /home/scanner/.cache/trivy/db/trivy.db ``` -------------------------------- ### Launching a Sub Job Source: https://github.com/goharbor/harbor/blob/main/src/jobservice/README.md Demonstrates how a job can launch a new sub-job using the LaunchJob function from the job context. ```go func (j *Job) Run(ctx job.Context, params job.Parameters) error{ // ... subJob, err := ctx.LaunchJob(models.JobRequest{}) // ... return nil } ``` -------------------------------- ### Create Docker Machine Instance Source: https://github.com/goharbor/harbor/blob/main/contrib/deploying_using_docker_machine.md Creates a virtual machine instance using Docker Machine with the DigitalOcean driver. Replace `` with your actual DigitalOcean access token and `harbor.mydomain.com` with your desired hostname. ```bash $ docker-machine create --driver digitalocean --digitalocean-access-token harbor.mydomain.com ``` -------------------------------- ### Verify Offline Installer Signature Source: https://github.com/goharbor/harbor/blob/main/docs/signature-verification.md Verifies the signature of the downloaded Harbor offline installer using Cosign. This command checks for authenticity and integrity. ```bash cosign verify-blob \ --bundle harbor-offline-installer-v2.15.0.tgz.sigstore.json \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-identity-regexp '^https://github.com/goharbor/harbor/.github/workflows/publish_release.yml@refs/tags/v.*$' \ harbor-offline-installer-v2.15.0.tgz ``` -------------------------------- ### Build Core Harbor Service Source: https://github.com/goharbor/harbor/blob/main/CONTRIBUTING.md Compile the main binary for the core Harbor service. ```sh make compile_core ``` -------------------------------- ### Build Harbor UI Docker Image Source: https://github.com/goharbor/harbor/blob/main/src/portal/docker-build/README.md Build the Docker image for the Harbor UI using the provided Dockerfile and tag it for testing. ```bash docker build -f ./Dockerfile -t harbor-ui:test ./../../.. ``` -------------------------------- ### Run Harbor Backup Script Source: https://github.com/goharbor/harbor/blob/main/contrib/backup-restore/README.md Execute the `harbor-backup` script to initiate the backup process. Various options can be specified to customize the backup, such as data paths and archive behavior. ```bash ./harbor-backup [OPTIONS] ``` -------------------------------- ### Angular CLI Default Port Start Script Source: https://github.com/goharbor/harbor/blob/main/src/portal/PACKAGE.md Starts the Angular CLI development server on the default HTTPS port (443) with SSL, host binding, and host check disabled. ```json "start_default_port": "node --max_old_space_size=2048 ./node_modules/@angular/cli/bin/ng serve --ssl true --host 0.0.0.0 --port 443 --disable-host-check --proxy-config proxy.config.json" ``` -------------------------------- ### Run UI Library Tests Source: https://github.com/goharbor/harbor/blob/main/CONTRIBUTING.md Execute unit tests for the UI library using npm. Navigate to the correct directory first. ```sh #cd #working_dir/src/portal/lib npm run test ``` -------------------------------- ### Restart Harbor Services Source: https://github.com/goharbor/harbor/wiki/Harbor-FAQs Restarts Harbor services by stopping and then starting the Docker Compose containers. ```bash docker-compose down -v docker-compose up -d ``` -------------------------------- ### Run Harbor Restore Script Source: https://github.com/goharbor/harbor/blob/main/contrib/backup-restore/README.md Execute the `harbor-restore` script to initiate the restore process. Use options to specify backup location and other configurations. ```bash ./harbor-restore [OPTIONS] ``` -------------------------------- ### Make Harbor Backup Script Executable Source: https://github.com/goharbor/harbor/blob/main/contrib/backup-restore/README.md Before running the `harbor-backup` script, you need to make it executable using the `chmod` command. ```bash chmod +x harbor-backup ``` -------------------------------- ### LDAP Filter for Group Membership Source: https://github.com/goharbor/harbor/wiki/Harbor-FAQs An example LDAP filter to restrict login to users who are members of a specific LDAP group. ```text (&(objectclass=person)(memberof=CN=harbor_users,OU=sample,OU=vmware,DC=harbor,DC=com)) ``` -------------------------------- ### Run Mock API Server Script Source: https://github.com/goharbor/harbor/blob/main/src/portal/PACKAGE.md Builds the mock API server and then runs it using Node.js. ```json "mock-api-server": "npm run build-mock-api-server && node server/dist/server/src/mock-api.js" ``` -------------------------------- ### Verify Environment Variables Source: https://github.com/goharbor/harbor/blob/main/tests/testcases/Group5-OVA-install-config/5-02-OVA-reboot.md Log in to the Harbor VM console as the root user and execute the 'ovfenv' command to verify that environment variables remain unchanged after a reboot or power cycle. ```bash ovfenv ``` -------------------------------- ### Get Current Working Directory Source: https://github.com/goharbor/harbor/blob/main/contrib/deploying_using_docker_machine.md Prints the current working directory. This is used to determine the local path to the Harbor deploy directory. ```bash $ echo $PWD ``` -------------------------------- ### Compile Job Service Binary Source: https://github.com/goharbor/harbor/blob/main/src/jobservice/README.md Compile the job service binary using the Go build command. Ensure you are in the 'jobservice' directory. ```go // under jobservice folder go build -a -o jobservice ``` -------------------------------- ### GET /api/v1/stats Source: https://github.com/goharbor/harbor/blob/main/src/jobservice/README.md Check the healthy status of the job service. This endpoint provides information about the worker pools, their status, and job concurrency. ```APIDOC ## GET /api/v1/stats ### Description Check the healthy status of the job service. This endpoint provides information about the worker pools, their status, and job concurrency. ### Method GET ### Endpoint /api/v1/stats ### Response #### Success Response (200 OK) - The response is an array of objects, each representing a worker pool. - **worker_pool_id** (string) - The ID of the worker pool. - **started_at** (integer) - The timestamp when the worker pool started. - **heartbeat_at** (integer) - The timestamp of the last heartbeat. - **job_names** (array) - An array of job names handled by the pool. - **concurrency** (integer) - The maximum concurrency of the worker pool. - **status** (string) - The health status of the worker pool (e.g., "healthy"). #### Response Example ```json [ { "worker_pool_id": "pool1", "started_at": 1539164886, "heartbeat_at": 1539164986, "job_names": ["DEMO"], "concurrency": 10, "status": "healthy" } ] ``` #### Error Response (401/500) - **code** (integer) - The error code. - **err** (string) - A short error message. - **description** (string) - A detailed error message. ```json { "code": 500, "err": "short error message", "description": "detailed error message" } ``` ``` -------------------------------- ### Configure Robot Variables Source: https://github.com/goharbor/harbor/blob/main/tests/e2e_setup/README.md Copy the sample robot variables file and update it with your specific environment settings, including the Harbor instance IP address. ```bash cd tests/e2e_setup cp robotvars.sample.py robotvars.py # update the environment variable in robotvars.py ``` -------------------------------- ### Get Job Log Response Source: https://github.com/goharbor/harbor/blob/main/src/jobservice/README.md The response for retrieving job logs contains the log text bytes upon successful retrieval. ```text Log text bytes ``` -------------------------------- ### Run Go Unit Tests Source: https://github.com/goharbor/harbor/blob/main/CONTRIBUTING.md Execute Go unit tests for a specific package. Ensure you are in the correct directory. ```sh #cd #working_dir/src/[package] go test -v ./... ``` -------------------------------- ### Add Mock API Endpoint Source: https://github.com/goharbor/harbor/blob/main/src/portal/server/README.md Add this line to your mock-api.ts file to define a GET endpoint for '/api/v2.0/scanners' that will be handled by the getScanner controller. ```typescript mockApi.get('/api/v2.0/scanners', Controllers.getScanner); ```