forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate the creation of release tags (opensearch-project#1666)
* Automate the creation of release tag Signed-off-by: Zelin Hao <[email protected]>
- Loading branch information
Showing
13 changed files
with
580 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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,57 @@ | ||
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm)) | ||
|
||
pipeline { | ||
options { | ||
timeout(time: 2, unit: 'HOURS') | ||
} | ||
agent { | ||
docker { | ||
label 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host' | ||
image 'opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211130' | ||
alwaysPull true | ||
} | ||
} | ||
parameters { | ||
string( | ||
name: 'BUILD_ID', | ||
description: 'Build ID of the distribution build manifest generated.', | ||
trim: true | ||
) | ||
string( | ||
name: 'VERSION', | ||
description: 'Version of the distribution build manifest.', | ||
trim: true | ||
) | ||
} | ||
environment { | ||
BUILD_MANIFEST = "builds/opensearch/manifest.yml" | ||
} | ||
stages { | ||
stage('Create Release Tag') { | ||
steps { | ||
script { | ||
manifest_path = "distribution-build-opensearch/${VERSION}/${BUILD_ID}/linux/x64/builds/opensearch/manifest.yml" | ||
downloadFromS3( | ||
destPath: "$WORKSPACE/$BUILD_MANIFEST", | ||
bucket: "${ARTIFACT_BUCKET_NAME}", | ||
path: "${manifest_path}", | ||
force: true | ||
) | ||
echo "Distribution build manifest is downloaded to $BUILD_MANIFEST" | ||
createReleaseTag( | ||
buildManifest: "$BUILD_MANIFEST", | ||
tagVersion: VERSION | ||
) | ||
|
||
} | ||
} | ||
} | ||
} | ||
post() { | ||
always { | ||
script { | ||
postCleanup() | ||
} | ||
} | ||
} | ||
} |
This file contains 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 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,28 @@ | ||
/* | ||
* 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 | ||
|
||
class TestCreateReleaseTag extends BuildPipelineTest { | ||
|
||
@Before | ||
void setUp() { | ||
|
||
this.registerLibTester(new CreateReleaseTagLibTester('tests/data/opensearch-build-1.1.0.yml', '1.1.0')) | ||
super.setUp() | ||
|
||
} | ||
|
||
@Test | ||
void testCreateReleaseTag() { | ||
super.testPipeline("tests/jenkins/jobs/CreateReleaseTag_Jenkinsfile") | ||
} | ||
} |
This file contains 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,43 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
|
||
import jenkins.tests.BuildPipelineTest | ||
import org.junit.Before | ||
import org.junit.Test | ||
|
||
class TestReleaseTagJob extends BuildPipelineTest { | ||
|
||
@Before | ||
void setUp() { | ||
|
||
def buildManifest = 'tests/data/opensearch-build-1.1.0.yml' | ||
|
||
def destPath = "${this.workspace}/${buildManifest}" | ||
|
||
def artifactsPath = 'distribution-build-opensearch/1.1.0/123/linux/x64/builds/opensearch/manifest.yml' | ||
|
||
def bucketName = 'job-s3-bucket-name' | ||
|
||
this.registerLibTester(new DownloadFromS3LibTester(destPath, bucketName, artifactsPath, true)) | ||
|
||
this.registerLibTester(new CreateReleaseTagLibTester(buildManifest, '1.1.0')) | ||
|
||
super.setUp() | ||
|
||
// Variables for Release Tag Job | ||
binding.setVariable('VERSION', '1.1.0') | ||
binding.setVariable('BUILD_ID', '123') | ||
binding.setVariable('ARTIFACT_BUCKET_NAME', bucketName) | ||
binding.setVariable('BUILD_MANIFEST', buildManifest) | ||
|
||
} | ||
|
||
@Test | ||
void ReleaseTag_test() { | ||
super.testPipeline('jenkins/release-tag/release-tag.jenkinsfile', | ||
'tests/jenkins/jenkinsjob-regression-files/release-tag/release-tag.jenkinsfile') | ||
} | ||
} |
157 changes: 157 additions & 0 deletions
157
tests/jenkins/jenkinsjob-regression-files/release-tag/release-tag.jenkinsfile.txt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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('createTag') { | ||
steps { | ||
script { | ||
createReleaseTag( | ||
buildManifest: "tests/data/opensearch-build-1.1.0.yml", | ||
tagVersion: "1.1.0" | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.