-
Notifications
You must be signed in to change notification settings - Fork 302
Add sha512 generation to promotion job #1367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
peternied
merged 3 commits into
opensearch-project:main
from
peternied:promote-with-sha
Dec 18, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package jenkins.tests | ||
|
||
import org.junit.* | ||
import java.util.* | ||
import java.nio.file.* | ||
|
||
|
||
class TestPromoteArtifacts extends BuildPipelineTest { | ||
private Path target; | ||
|
||
@Override | ||
@Before | ||
void setUp() { | ||
super.setUp() | ||
|
||
binding.setVariable('PUBLIC_ARTIFACT_URL', 'https://ci.opensearch.org/dbc') | ||
binding.setVariable('DISTRIBUTION_JOB_NAME', 'vars-build') | ||
binding.setVariable('ARTIFACT_BUCKET_NAME', 'artifact-bucket') | ||
binding.setVariable('AWS_ACCOUNT_PUBLIC', 'account') | ||
binding.setVariable('STAGE_NAME', 'stage') | ||
binding.setVariable('BUILD_URL', 'http://jenkins.us-east-1.elb.amazonaws.com/job/vars/42') | ||
binding.setVariable('DISTRIBUTION_BUILD_NUMBER', '33') | ||
binding.setVariable('DISTRIBUTION_PLATFORM', 'x64') | ||
binding.setVariable('DISTRIBUTION_ARCHITECTURE', 'linux') | ||
binding.setVariable('ARTIFACT_DOWNLOAD_ROLE_NAME', 'downloadRoleName') | ||
binding.setVariable('AWS_ACCOUNT_PUBLIC', 'publicAccount') | ||
binding.setVariable('ARTIFACT_PROMOTION_ROLE_NAME', 'artifactPromotionRole') | ||
binding.setVariable('AWS_ACCOUNT_ARTIFACT', 'artifactsAccount') | ||
binding.setVariable('ARTIFACT_PRODUCTION_BUCKET_NAME', 'prod-bucket-name') | ||
binding.setVariable('WORKSPACE', 'workspace') | ||
|
||
helper.registerAllowedMethod("git", [Map]) | ||
helper.registerAllowedMethod("s3Download", [Map]) | ||
helper.registerAllowedMethod("s3Upload", [Map]) | ||
helper.registerAllowedMethod("withAWS", [Map, Closure], { args, closure -> | ||
closure.delegate = delegate | ||
return helper.callClosure(closure) | ||
}) | ||
helper.registerAllowedMethod('getPath', { args -> | ||
return "workspace/file/found.zip" | ||
}) | ||
helper.registerAllowedMethod('findFiles', [Map], { args -> | ||
return [{}] | ||
}) | ||
|
||
Path source = Path.of("tests/data/opensearch-build-1.1.0.yml"); | ||
target = Path.of("artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/manifest.yml"); | ||
Files.createDirectories(target.getParent()); | ||
Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING); | ||
} | ||
|
||
@After | ||
void after() { | ||
super.setUp() | ||
Files.delete(target) // Test file needs to be cleaned up | ||
} | ||
|
||
@Test | ||
public void testDefault() { | ||
super.testPipeline("tests/jenkins/jobs/PromoteArtifacts_Jenkinsfile") | ||
} | ||
|
||
@Test | ||
public void testWithActions() { | ||
super.testPipeline("tests/jenkins/jobs/PromoteArtifacts_actions_Jenkinsfile") | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pipeline { | ||
agent none | ||
stages { | ||
stage('promote') { | ||
steps { | ||
script { | ||
promoteArtifacts( | ||
manifest: 'tests/jenkins/data/opensearch-1.3.0.yml' | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
PromoteArtifacts_Jenkinsfile.run() | ||
PromoteArtifacts_Jenkinsfile.pipeline(groovy.lang.Closure) | ||
PromoteArtifacts_Jenkinsfile.echo(Executing on agent [label:none]) | ||
PromoteArtifacts_Jenkinsfile.stage(promote, groovy.lang.Closure) | ||
PromoteArtifacts_Jenkinsfile.script(groovy.lang.Closure) | ||
PromoteArtifacts_Jenkinsfile.promoteArtifacts({manifest=tests/jenkins/data/opensearch-1.3.0.yml}) | ||
promoteArtifacts.git({url=https://github.com/opensearch-project/opensearch-build.git, branch=main}) | ||
promoteArtifacts.legacySCM(groovy.lang.Closure) | ||
promoteArtifacts.library({identifier=jenkins@20211123, retriever=null}) | ||
promoteArtifacts.readYaml({file=tests/jenkins/data/opensearch-1.3.0.yml}) | ||
InputManifest.asBoolean() | ||
promoteArtifacts.withAWS({role=downloadRoleName, roleAccount=publicAccount, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure) | ||
promoteArtifacts.s3Download({bucket=artifact-bucket, file=workspace/artifacts, path=vars-build/1.3.0/33/x64/linux/, force=true}) | ||
promoteArtifacts.readYaml({file=artifacts/vars-build/1.3.0/33/x64/linux/builds/opensearch/manifest.yml}) | ||
promoteArtifacts.withAWS({role=artifactPromotionRole, roleAccount=artifactsAccount, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure) | ||
promoteArtifacts.println(Start Core Plugin Promotion to artifects.opensearch.org Bucket) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
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*}) | ||
promoteArtifacts.println(Start Tar Core/Bundle Promotion to artifacts.opensearch.org Bucket) | ||
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*}) | ||
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*}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
pipeline { | ||
agent none | ||
stages { | ||
stage('promote') { | ||
steps { | ||
script { | ||
promoteArtifacts( | ||
manifest: 'tests/jenkins/data/opensearch-1.3.0.yml', | ||
fileActions: [createSha512()] | ||
peternied marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.