Skip to content

Commit

Permalink
Update lib location on jenkins/ to the remote repository opensearch-b…
Browse files Browse the repository at this point in the history
…uild-libraries (#2652)

* update lib location

Signed-off-by: Jeff Lu <[email protected]>

* issue_2646

Signed-off-by: Jeff Lu <[email protected]>

* update new Lib buildPipelineTest.groovy

Signed-off-by: Jeff Lu <[email protected]>

* update regression files

Signed-off-by: Jeff Lu <[email protected]>

* update test lib with override and setting up main as default version in BuildPipelineTest

Signed-off-by: Jeff Lu <[email protected]>

* update lib location on tests/jenkins/jobs and associated regression files

Signed-off-by: Jeff Lu <[email protected]>

* remove unnecessary import statement

Signed-off-by: Jeff Lu <[email protected]>

Signed-off-by: Jeff Lu <[email protected]>
  • Loading branch information
jordarlu authored Sep 28, 2022
1 parent 0bbeeb2 commit af69515
Show file tree
Hide file tree
Showing 81 changed files with 397 additions and 126 deletions.
5 changes: 4 additions & 1 deletion jenkins/check-for-build.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211123", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/cross-cluster-replication/perf-test.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211118", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
agent none
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/docker/docker-copy.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/docker/docker-scan.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/gradle/gradle-check.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/opensearch-dashboards/bwc-test.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211118", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/opensearch-dashboards/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/opensearch-dashboards/integ-test.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211118", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
agent {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/opensearch-ruby/opensearch-ruby.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/opensearch/bwc-test.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211118", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211123", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/opensearch/integ-test.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211118", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/opensearch/perf-test.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211118", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
agent none
Expand Down
5 changes: 4 additions & 1 deletion jenkins/promotion/promote-artifacts.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211123", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/promotion/promote-docker-ecr.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/promotion/promote-yum-repos.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211123", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/release-notes-check/release-notes-check.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/release-tag/release-tag.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
options {
Expand Down
5 changes: 4 additions & 1 deletion jenkins/rpm-validation/rpm-validation.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: "jenkins@20211123", retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
agent none
Expand Down
5 changes: 4 additions & 1 deletion jenkins/sign-artifacts/sign-standalone-artifacts.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))

pipeline {
agent {
Expand Down
10 changes: 6 additions & 4 deletions tests/jenkins/BuildPipelineTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package jenkins.tests

import org.junit.*
import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.ProjectSource.projectSource
import static com.lesfurets.jenkins.unit.global.lib.GitSource.gitSource
import com.lesfurets.jenkins.unit.*
import org.yaml.snakeyaml.Yaml

Expand All @@ -36,11 +36,11 @@ abstract class BuildPipelineTest extends CommonPipelineTest {

helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('<notNeeded>')
.defaultVersion('main')
.allowOverride(true)
.implicit(true)
.targetPath('<notNeeded>')
.retriever(projectSource())
.targetPath('vars')
.retriever(gitSource('https://github.com/opensearch-project/opensearch-build-libraries.git'))
.build()
)

Expand All @@ -51,6 +51,8 @@ abstract class BuildPipelineTest extends CommonPipelineTest {
binding.setVariable('scm', {})

helper.registerAllowedMethod("legacySCM", [Closure.class], null)

helper.registerAllowedMethod("modernSCM", [Map.class], null)

helper.registerAllowedMethod("library", [Map.class], { Map args ->
helper.getLibLoader().loadLibrary(args["identifier"])
Expand Down
14 changes: 14 additions & 0 deletions tests/jenkins/TestCCRPerfTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ import static org.hamcrest.CoreMatchers.equalTo
import static org.hamcrest.CoreMatchers.hasItem
import static org.hamcrest.MatcherAssert.assertThat

import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.GitSource.gitSource

class TestCCRPerfTest extends BuildPipelineTest {

@Override
@Before
void setUp() {
this.registerLibTester(new RunPerfTestScriptLibTester(
Expand All @@ -29,6 +33,16 @@ class TestCCRPerfTest extends BuildPipelineTest {
true
))
super.setUp()

helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('1.0.0')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
.retriever(gitSource('https://github.com/opensearch-project/opensearch-build-libraries.git'))
.build()
)
}

@Test
Expand Down
13 changes: 13 additions & 0 deletions tests/jenkins/TestCopyContainer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@
*/
import jenkins.tests.BuildPipelineTest
import org.junit.*
import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.GitSource.gitSource

class TestCopyContainer extends BuildPipelineTest {

String sourceImage = 'alpine:3.15.4'
String destinationImage = 'alpine:3.15.4'

@Override
@Before
void setUp() {

binding.setVariable('DOCKER_USERNAME', 'dummy_docker_username')
binding.setVariable('DOCKER_PASSWORD', 'dummy_docker_password')
binding.setVariable('ARTIFACT_PROMOTION_ROLE_NAME', 'sample-agent-AssumeRole')
Expand All @@ -23,6 +27,15 @@ class TestCopyContainer extends BuildPipelineTest {
helper.registerAllowedMethod('withAWS', [Map, Closure], null)
super.setUp()

helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('1.0.0')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
.retriever(gitSource('https://github.com/opensearch-project/opensearch-build-libraries.git'))
.build()
)
}

@Test
Expand Down
14 changes: 14 additions & 0 deletions tests/jenkins/TestDataPrepperReleaseArtifacts.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ import static org.hamcrest.CoreMatchers.hasItems
import static org.hamcrest.CoreMatchers.notNullValue
import static org.hamcrest.MatcherAssert.assertThat

import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.GitSource.gitSource

class TestDataPrepperReleaseArtifacts extends BuildPipelineTest {

private String version

@Override
@Before
void setUp() {

Expand Down Expand Up @@ -45,6 +49,16 @@ class TestDataPrepperReleaseArtifacts extends BuildPipelineTest {
})

helper.registerAllowedMethod('s3Upload', [Map], {})

helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('1.0.0')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
.retriever(gitSource('https://github.com/opensearch-project/opensearch-build-libraries.git'))
.build()
)
}

@Test
Expand Down
13 changes: 13 additions & 0 deletions tests/jenkins/TestMavenSignReleaseJob.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import jenkins.tests.BuildPipelineTest
import org.junit.Before
import org.junit.Test
import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.GitSource.gitSource

class TestMavenSignReleaseJob extends BuildPipelineTest {

@Override
@Before
void setUp() {

Expand All @@ -36,6 +39,16 @@ class TestMavenSignReleaseJob extends BuildPipelineTest {

helper.registerAllowedMethod('checkout', [Map], {})

helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('1.0.0')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
.retriever(gitSource('https://github.com/opensearch-project/opensearch-build-libraries.git'))
.build()
)

}

@Test
Expand Down
13 changes: 13 additions & 0 deletions tests/jenkins/TestOpenSearchBwcTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import jenkins.tests.BuildPipelineTest
import org.junit.Before
import org.junit.Test
import org.yaml.snakeyaml.Yaml
import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library
import static com.lesfurets.jenkins.unit.global.lib.GitSource.gitSource

class TestOpenSearchBwcTest extends BuildPipelineTest {

@Override
@Before
void setUp() {
def jobName = "dummy_job"
Expand Down Expand Up @@ -48,6 +51,16 @@ class TestOpenSearchBwcTest extends BuildPipelineTest {
})

helper.registerAllowedMethod('findFiles', [Map.class], null)

helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('1.0.0')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
.retriever(gitSource('https://github.com/opensearch-project/opensearch-build-libraries.git'))
.build()
)
}

@Test
Expand Down
Loading

0 comments on commit af69515

Please sign in to comment.