forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestSignStandaloneArtifactsJob.groovy
77 lines (63 loc) · 3.15 KB
/
TestSignStandaloneArtifactsJob.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
75
76
77
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
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 TestSignStandaloneArtifactsJob extends BuildPipelineTest {
@Override
@Before
void setUp() {
def filenamesForUrls = ['dummy_1_artifact.tar.gz', 'dummy_1_artifact.tar.gz.sig',
'dummy_2_artifact.tar.gz', 'dummy_2_artifact.tar.gz.sig']
def sigtype = '.sig'
def platform = 'linux'
def artifactPath = "${this.workspace}/artifacts"
// this.registerLibTester(new SignArtifactsLibTester(sigtype, platform, artifactPath, null, 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)
})
// this.registerLibTester(new PrintArtifactDownloadUrlsForStagingLibTester(filenamesForUrls, 'sign_artifacts_job/dummy/upload/path/20/dist/signed'))
// this.registerLibTester(new UploadToS3LibTester(artifactPath, 'dummy_bucket_name', 'sign_artifacts_job/dummy/upload/path/20/dist/signed'))
binding.setVariable('AWS_ACCOUNT_PUBLIC', 'dummy_account')
binding.setVariable('ARTIFACT_BUCKET_NAME', 'dummy_bucket_name')
helper.registerAllowedMethod("s3Upload", [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()
// Params
binding.setVariable('URLs', 'https://www.dummy.com/dummy_1_artifact.tar.gz,' +
' https://www.dummy.com/dummy_2_artifact.tar.gz')
binding.setVariable('S3_FILE_UPLOAD_PATH', '/dummy/upload/path/')
binding.setVariable('DISTRIBUTION_PLATFORM', platform)
binding.setVariable('SIGNATURE_TYPE', sigtype)
}
@Test
void testSignArtifactsJob() {
binding.setVariable('JOB_NAME', 'sign_artifacts_job')
binding.setVariable('BUILD_NUMBER', '20')
binding.setVariable('ARTIFACT_BUCKET_NAME', 'dummy_bucket_name')
super.testPipeline("jenkins/sign-artifacts/sign-standalone-artifacts.jenkinsfile",
"tests/jenkins/jenkinsjob-regression-files/sign-standalone-artifacts/sign-standalone-artifacts.jenkinsfile")
}
}