forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestMavenSignReleaseJob.groovy
74 lines (60 loc) · 2.9 KB
/
TestMavenSignReleaseJob.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
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() {
helper.registerSharedLibrary(
library().name('jenkins')
.defaultVersion('1.0.4')
.allowOverride(true)
.implicit(true)
.targetPath('vars')
.retriever(gitSource('https://github.com/opensearch-project/opensearch-build-libraries.git'))
.build()
)
def destPath = "${this.workspace}/artifacts"
def manifestPath = "${this.workspace}/artifacts/distribution-build-opensearch/1.0.0/123/linux/x64/builds/opensearch/manifest.yml"
def artifactsPath = 'distribution-build-opensearch/1.0.0/123/linux/x64/builds/'
def bucketName = 'job-s3-bucket-name'
// this.registerLibTester(new DownloadFromS3LibTester(destPath, bucketName, artifactsPath, true))
binding.setVariable('ARTIFACT_DOWNLOAD_ROLE_NAME', 'Dummy_Download_Role')
binding.setVariable('AWS_ACCOUNT_PUBLIC', 'dummy_account')
helper.registerAllowedMethod("s3Download", [Map])
helper.registerAllowedMethod("withAWS", [Map, Closure], { args, closure ->
closure.delegate = delegate
return helper.callClosure(closure)
})
// this.registerLibTester(new SignArtifactsLibTester( '.sig', 'linux', manifestPath, 'maven', null))
binding.setVariable('GITHUB_BOT_TOKEN_NAME', 'github_bot_token_name')
helper.registerAllowedMethod('git', [Map])
helper.registerAllowedMethod('withCredentials', [Map, Closure], { args, closure ->
closure.delegate = delegate
return helper.callClosure(closure)
})
helper.registerAllowedMethod('withAWS', [Map, Closure], { args, closure ->
closure.delegate = delegate
return helper.callClosure(closure)
})
super.setUp()
// Variables for Maven Sign Release job
binding.setVariable('VERSION', '1.0.0')
binding.setVariable('BUILD_ID', '123')
binding.setVariable('ARTIFACT_PATH', 'distribution-build-opensearch/1.0.0/123/linux/x64/builds')
binding.setVariable('ARTIFACT_BUCKET_NAME', bucketName)
binding.setVariable('SONATYPE_STAGING_PROFILE_ID', 'dummy_id')
helper.registerAllowedMethod('checkout', [Map], {})
}
@Test
void MavenSignRelease_test() {
super.testPipeline('jenkins/opensearch-maven-release/maven-sign-release.jenkinsfile',
'tests/jenkins/jenkinsjob-regression-files/maven-sign-release/maven-sign-release.jenkinsfile')
}
}