Skip to content

Latest commit

 

History

History
58 lines (48 loc) · 2.15 KB

README.md

File metadata and controls

58 lines (48 loc) · 2.15 KB

Jenkins Shared Library

The experimental shared libraries for running E2E tests against Harbor instance(2.3+) on Jenkins.

Prerequisites

Runs As Jenkins Shared Library

  1. Register this repository as the Global Pipeline Libraries(named harbor) in Jenkins according to this guide.

  2. Import the registered library in Jenkinsfile:

    // import main branch to run cases against Harbor instance deployed from master branch
    @Library('harbor@main') _
    
    // import 2.3 branch to run cases against Harbor instance v2.3.x
    @Library('harbor@2.3') _
    

    Notes: Import the corresponding branch of the library for the Harbor instance to be tested. e.g. for Harbor v2.3.x importing branch 2.3

  3. Use the libraries in Jenkinsfile

    @Library('harbor@main') _
    import io.goharbor.*
    
    node() {
        HarborInstance instance = new HarborInstance()
        instance.coreServiceURL = "https://harbor.local"
        instance.notaryServiceURL = "https://notary.harbor.local"
    
        stage('Health-Check') {
            check_health(instance)
        }
        stage('Test') {
            CaseSettings caseSettings = new CaseSettings()
            caseSettings.branch = "master"
            run_test_case(instance, caseSettings, "workdir")
        }
        stage('Publish-Result') {
            publish_test_result("workdir/result")
        }
    }
    

Libraries

Pipelines