Skip to content

Commit ce15479

Browse files
authored
Add sha512 generation to promotion job (#1367)
1 parent 7def587 commit ce15479

8 files changed

+305
-9
lines changed

jenkins/promotion/tar-promotion.jenkinsfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ pipeline {
4545
}
4646
steps {
4747
script {
48-
promoteArtifacts()
48+
promoteArtifacts(
49+
fileActions: [createSha512()]
50+
)
4951
}
5052
}
5153
post() {
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*/
8+
9+
package jenkins.tests
10+
11+
import org.junit.*
12+
import java.util.*
13+
import java.nio.file.*
14+
15+
16+
class TestPromoteArtifacts extends BuildPipelineTest {
17+
private Path target;
18+
19+
@Override
20+
@Before
21+
void setUp() {
22+
super.setUp()
23+
24+
binding.setVariable('PUBLIC_ARTIFACT_URL', 'https://ci.opensearch.org/dbc')
25+
binding.setVariable('DISTRIBUTION_JOB_NAME', 'vars-build')
26+
binding.setVariable('ARTIFACT_BUCKET_NAME', 'artifact-bucket')
27+
binding.setVariable('AWS_ACCOUNT_PUBLIC', 'account')
28+
binding.setVariable('STAGE_NAME', 'stage')
29+
binding.setVariable('BUILD_URL', 'http://jenkins.us-east-1.elb.amazonaws.com/job/vars/42')
30+
binding.setVariable('DISTRIBUTION_BUILD_NUMBER', '33')
31+
binding.setVariable('DISTRIBUTION_PLATFORM', 'x64')
32+
binding.setVariable('DISTRIBUTION_ARCHITECTURE', 'linux')
33+
binding.setVariable('ARTIFACT_DOWNLOAD_ROLE_NAME', 'downloadRoleName')
34+
binding.setVariable('AWS_ACCOUNT_PUBLIC', 'publicAccount')
35+
binding.setVariable('ARTIFACT_PROMOTION_ROLE_NAME', 'artifactPromotionRole')
36+
binding.setVariable('AWS_ACCOUNT_ARTIFACT', 'artifactsAccount')
37+
binding.setVariable('ARTIFACT_PRODUCTION_BUCKET_NAME', 'prod-bucket-name')
38+
binding.setVariable('WORKSPACE', 'workspace')
39+
40+
helper.registerAllowedMethod("git", [Map])
41+
helper.registerAllowedMethod("s3Download", [Map])
42+
helper.registerAllowedMethod("s3Upload", [Map])
43+
helper.registerAllowedMethod("withAWS", [Map, Closure], { args, closure ->
44+
closure.delegate = delegate
45+
return helper.callClosure(closure)
46+
})
47+
helper.registerAllowedMethod('getPath', { args ->
48+
return "workspace/file/found.zip"
49+
})
50+
helper.registerAllowedMethod('findFiles', [Map], { args ->
51+
return [{}]
52+
})
53+
54+
Path source = Path.of("tests/data/opensearch-build-1.1.0.yml");
55+
target = Path.of("artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/manifest.yml");
56+
Files.createDirectories(target.getParent());
57+
Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
58+
}
59+
60+
@After
61+
void after() {
62+
super.setUp()
63+
Files.delete(target) // Test file needs to be cleaned up
64+
}
65+
66+
@Test
67+
public void testDefault() {
68+
super.testPipeline("tests/jenkins/jobs/PromoteArtifacts_Jenkinsfile")
69+
}
70+
71+
@Test
72+
public void testWithActions() {
73+
super.testPipeline("tests/jenkins/jobs/PromoteArtifacts_actions_Jenkinsfile")
74+
}
75+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pipeline {
2+
agent none
3+
stages {
4+
stage('promote') {
5+
steps {
6+
script {
7+
promoteArtifacts(
8+
manifest: 'tests/jenkins/data/opensearch-1.3.0.yml'
9+
)
10+
}
11+
}
12+
}
13+
}
14+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
PromoteArtifacts_Jenkinsfile.run()
2+
PromoteArtifacts_Jenkinsfile.pipeline(groovy.lang.Closure)
3+
PromoteArtifacts_Jenkinsfile.echo(Executing on agent [label:none])
4+
PromoteArtifacts_Jenkinsfile.stage(promote, groovy.lang.Closure)
5+
PromoteArtifacts_Jenkinsfile.script(groovy.lang.Closure)
6+
PromoteArtifacts_Jenkinsfile.promoteArtifacts({manifest=tests/jenkins/data/opensearch-1.3.0.yml})
7+
promoteArtifacts.git({url=https://github.com/opensearch-project/opensearch-build.git, branch=main})
8+
promoteArtifacts.legacySCM(groovy.lang.Closure)
9+
promoteArtifacts.library({identifier=jenkins@20211123, retriever=null})
10+
promoteArtifacts.readYaml({file=tests/jenkins/data/opensearch-1.3.0.yml})
11+
InputManifest.asBoolean()
12+
promoteArtifacts.withAWS({role=downloadRoleName, roleAccount=publicAccount, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure)
13+
promoteArtifacts.s3Download({bucket=artifact-bucket, file=workspace/artifacts, path=vars-build/1.3.0/33/x64/linux/, force=true})
14+
promoteArtifacts.readYaml({file=artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/manifest.yml})
15+
promoteArtifacts.withAWS({role=artifactPromotionRole, roleAccount=artifactsAccount, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure)
16+
promoteArtifacts.println(Start Core Plugin Promotion to artifects.opensearch.org Bucket)
17+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/discovery-ec2-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/discovery-ec2-1.1.0.zip*})
18+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/transport-nio-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/transport-nio-1.1.0.zip*})
19+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/discovery-gce-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/discovery-gce-1.1.0.zip*})
20+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/analysis-ukrainian-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/analysis-ukrainian-1.1.0.zip*})
21+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/discovery-azure-classic-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/discovery-azure-classic-1.1.0.zip*})
22+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/analysis-phonetic-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/analysis-phonetic-1.1.0.zip*})
23+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/mapper-murmur3-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/mapper-murmur3-1.1.0.zip*})
24+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/analysis-kuromoji-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/analysis-kuromoji-1.1.0.zip*})
25+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/analysis-stempel-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/analysis-stempel-1.1.0.zip*})
26+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/mapper-annotated-text-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/mapper-annotated-text-1.1.0.zip*})
27+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/repository-hdfs-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/repository-hdfs-1.1.0.zip*})
28+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/analysis-icu-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/analysis-icu-1.1.0.zip*})
29+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/mapper-size-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/mapper-size-1.1.0.zip*})
30+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/ingest-attachment-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/ingest-attachment-1.1.0.zip*})
31+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/repository-azure-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/repository-azure-1.1.0.zip*})
32+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/repository-s3-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/repository-s3-1.1.0.zip*})
33+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/analysis-nori-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/analysis-nori-1.1.0.zip*})
34+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/store-smb-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/store-smb-1.1.0.zip*})
35+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/analysis-smartcn-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/analysis-smartcn-1.1.0.zip*})
36+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/plugins/repository-gcs-1.1.0.zip/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/core-plugins/, includePathPattern=**/repository-gcs-1.1.0.zip*})
37+
promoteArtifacts.println(Start Tar Core/Bundle Promotion to artifacts.opensearch.org Bucket)
38+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/core/opensearch/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/dist/, includePathPattern=**/opensearch-min-1.3.0*})
39+
promoteArtifacts.s3Upload({bucket=prod-bucket-name, path=releases/bundle/opensearch/1.3.0/, workingDir=workspace/artifacts/vars-build/1.3.0/33/x64/linux/dist/opensearch/, includePathPattern=**/opensearch*-1.3.0*})
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pipeline {
2+
agent none
3+
stages {
4+
stage('promote') {
5+
steps {
6+
script {
7+
promoteArtifacts(
8+
manifest: 'tests/jenkins/data/opensearch-1.3.0.yml',
9+
fileActions: [createSha512()]
10+
)
11+
}
12+
}
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)