From a30d48b0e9c59de50b915436610f92d44a9c146b Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Thu, 3 Feb 2022 23:27:03 +0000 Subject: [PATCH 01/17] Release jenkins workflow tasks Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 scripts/opensearch-build/release.jenkinsfile diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile new file mode 100644 index 0000000000..92d1085a56 --- /dev/null +++ b/scripts/opensearch-build/release.jenkinsfile @@ -0,0 +1,53 @@ +lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm)) + +pipeline { + agent { + defaultReleaseDockerAgent() + } + parameters { + string(name: 'DistManifestUrl', description: 'Where the manifest is stored') + } + stages { + stage('Sign/Release Artifacts') { + steps { + downloadArtifactsFromManifest(manifestUrl: params.DistManifestUrl) + + // Signing workflow + signArtifacts( + artifactsPath: 'build', + signatureType: '.sig', + distributionPlatform: 'linux', + ) + + // Replace with publishToMaven(...) + withCredentials([usernamePassword(credentialsId: 'Sonatype', usernameVariable: 'SONATYPE_USERNAME', passwordVariable: 'SONATYPE_PASSWORD')]) { + sh('$WORKSPACE/publish/publish-snapshot.sh $WORKSPACE/builds/opensearch/maven') + } + + // Replace with publishToArtifactRepositry(...) + withAWS(role: "${ARTIFACT_PROMOTION_ROLE_NAME}", roleAccount: "${AWS_ACCOUNT_ARTIFACT}", duration: 900, roleSessionName: 'jenkins-session') { + s3Upload(file: 'distribution/', bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${distManifest.product}/${distManifest.version}/") + } + } + } + stage('Docker Release') { + steps { + def distManifest = lib.DistManifest.from(url: params.DistManifestUrl) + + copyDockerImage( + sourceImagePath: distManifest.dockerImage, + destinationImagePath: "opensearchproject/${distManifest.product}:${distManifest.version}", + destinationType: "docker", + destinationCredentialIdentifier: "jenkins-staging-docker-prod-token" + ) + } + } + } + post { + always { + script { + postCleanUp() // Update to also do docker cleanup too + } + } + } +} \ No newline at end of file From 0484f1792e61ccedbea35e45c4187e7364ba6215 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 21:01:15 +0000 Subject: [PATCH 02/17] Adding small test jenkinsfile Signed-off-by: Peter Nied --- scripts/opensearch-build/release-test.jenkinsfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 scripts/opensearch-build/release-test.jenkinsfile diff --git a/scripts/opensearch-build/release-test.jenkinsfile b/scripts/opensearch-build/release-test.jenkinsfile new file mode 100644 index 0000000000..74759600f5 --- /dev/null +++ b/scripts/opensearch-build/release-test.jenkinsfile @@ -0,0 +1,13 @@ +lib = library( + identifier: 'jenkins@uni-poc', + retriever:modernSCM( + [$class: 'GitSCMSource', + credentialsId: '', + remote: 'https://github.com/peternied/opensearch-build.git', + traits: [gitBranchDiscovery()] + ]) + ) + +defaultPipeline { + echo "hello from this closure" +} \ No newline at end of file From 4400ba0206f1a79631077ff9151bc5398ff396e2 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:15:56 +0000 Subject: [PATCH 03/17] Flesh out calls with mocks so it can run Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 131 ++++++++++++------- 1 file changed, 85 insertions(+), 46 deletions(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index 92d1085a56..72661cf36d 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -1,53 +1,92 @@ -lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm)) +properties([ + parameters([ + string( + name: 'DistManifestUrl', + description: 'The url to distribution manifest for this release')]) +]) -pipeline { - agent { - defaultReleaseDockerAgent() +lib = library( + identifier: 'jenkins@uni-poc', + retriever:modernSCM( + [$class: 'GitSCMSource', + remote: 'https://github.com/peternied/opensearch-build.git', + traits: [gitBranchDiscovery()] + ]) + ) + +defaultPipeline { + def distManifest = new FakeDistManifest(fakeYmlFromUrl(params.DistManifestUrl)) + + def downloadPath = fakeDownloadArtifacts(distManifest) + + // Signing workflow + signArtifacts( + artifactsPath: downloadPath, + signatureType: '.sig', + distributionPlatform: 'linux', + ) + + // Replace with publishToMaven(...) + fakeWithCredentials([usernamePassword(credentialsId: 'Sonatype', usernameVariable: 'SONATYPE_USERNAME', passwordVariable: 'SONATYPE_PASSWORD')]) { + sh('$WORKSPACE/publish/publish-snapshot.sh $WORKSPACE/dist/${distManifest.product}/maven') } - parameters { - string(name: 'DistManifestUrl', description: 'Where the manifest is stored') + + // Replace with publishToArtifactRepositry(...) + fakeWithAWS(role: "${ARTIFACT_PROMOTION_ROLE_NAME}", roleAccount: "${AWS_ACCOUNT_ARTIFACT}", duration: 900, roleSessionName: 'jenkins-session') { + s3Upload(file: 'distribution/', bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${distManifest.product}/${distManifest.version}/") } - stages { - stage('Sign/Release Artifacts') { - steps { - downloadArtifactsFromManifest(manifestUrl: params.DistManifestUrl) - - // Signing workflow - signArtifacts( - artifactsPath: 'build', - signatureType: '.sig', - distributionPlatform: 'linux', - ) - - // Replace with publishToMaven(...) - withCredentials([usernamePassword(credentialsId: 'Sonatype', usernameVariable: 'SONATYPE_USERNAME', passwordVariable: 'SONATYPE_PASSWORD')]) { - sh('$WORKSPACE/publish/publish-snapshot.sh $WORKSPACE/builds/opensearch/maven') - } - - // Replace with publishToArtifactRepositry(...) - withAWS(role: "${ARTIFACT_PROMOTION_ROLE_NAME}", roleAccount: "${AWS_ACCOUNT_ARTIFACT}", duration: 900, roleSessionName: 'jenkins-session') { - s3Upload(file: 'distribution/', bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${distManifest.product}/${distManifest.version}/") - } - } - } - stage('Docker Release') { - steps { - def distManifest = lib.DistManifest.from(url: params.DistManifestUrl) - - copyDockerImage( - sourceImagePath: distManifest.dockerImage, - destinationImagePath: "opensearchproject/${distManifest.product}:${distManifest.version}", - destinationType: "docker", - destinationCredentialIdentifier: "jenkins-staging-docker-prod-token" - ) - } + + fakeCopyDockerImage( + sourceImagePath: distManifest.artifacts.containerReference, + destinationImagePath: "opensearchproject/${distManifest.product}:${distManifest.version}", + destinationType: "docker", + destinationCredentialIdentifier: "jenkins-staging-docker-prod-token" + ) +} + +class FakeDistManifest implements Serializable { + // Additional contents need to be added to the dist manifest for + // these parameters + class Artifacts implements Serializable { + String containerReference + Artifacts(Map data) { + this.containerReference = data?.containerReference } } - post { - always { - script { - postCleanUp() // Update to also do docker cleanup too - } - } + + Artifacts artifacts + String product + String version + FakeDistManifest(Map data) { + echo "new DisManifest: ${data}" + this.artifacts = new Artifacts(data?.artifacts) + this.product = data?.product + this.version = data?.product } +} + +Map fakeYmlFromUrl(String url) { + echo "ymlFromUrl: ${url}" + return [:] +} + +def fakeDownloadArtifacts(FakeDistManifest manifest) { + echo "fakeDownloadArtifacts" + +} + +def fakeSignArtifacts(Map args) { + echo "fakeDownloadArtifacts ${args}" +} + +def fakeWithCredentials(Map args, Closure closure) { + echo "fakeWithCredentials, not running inner closure" +} + +def fakeWithAWS(Map args, Closure closure) { + echo "fakeWithAWS, not running inner closure" +} + +def fakeCopyDockerImage(Map args) { + echo "fakeCopyDockerImage ${args}" } \ No newline at end of file From d0e2a56c100dad2d53cc074a66eca6dd5e4ebc28 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:16:41 +0000 Subject: [PATCH 04/17] Fix funct call Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index 72661cf36d..9f91a1a44e 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -14,7 +14,7 @@ lib = library( ]) ) -defaultPipeline { +standardReleasePipeline { def distManifest = new FakeDistManifest(fakeYmlFromUrl(params.DistManifestUrl)) def downloadPath = fakeDownloadArtifacts(distManifest) From 1c891860225a428da58e29f6e5d1b5adc9bc0485 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:19:39 +0000 Subject: [PATCH 05/17] Use println in object Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index 9f91a1a44e..1a4f070a05 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -58,7 +58,7 @@ class FakeDistManifest implements Serializable { String product String version FakeDistManifest(Map data) { - echo "new DisManifest: ${data}" + println "new DisManifest: ${data}" this.artifacts = new Artifacts(data?.artifacts) this.product = data?.product this.version = data?.product From 06156ade3a43f2e8eb1408e646895eb776cc84ae Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:20:59 +0000 Subject: [PATCH 06/17] Use fake signer Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index 1a4f070a05..dc3afb7583 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -20,7 +20,7 @@ standardReleasePipeline { def downloadPath = fakeDownloadArtifacts(distManifest) // Signing workflow - signArtifacts( + fakeSignArtifacts( artifactsPath: downloadPath, signatureType: '.sig', distributionPlatform: 'linux', From 70acff9dbbd135c0c31a2a97a2c5f7148f14c00f Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:22:09 +0000 Subject: [PATCH 07/17] Play with signatures Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index dc3afb7583..d4060bd926 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -79,11 +79,11 @@ def fakeSignArtifacts(Map args) { echo "fakeDownloadArtifacts ${args}" } -def fakeWithCredentials(Map args, Closure closure) { +def fakeWithCredentials(Closure closure) { echo "fakeWithCredentials, not running inner closure" } -def fakeWithAWS(Map args, Closure closure) { +def fakeWithAWS(Closure closure) { echo "fakeWithAWS, not running inner closure" } From 7e26662f41ddc66d42fa92b5d0166bc030d955b7 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:23:08 +0000 Subject: [PATCH 08/17] Play with signatures Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index d4060bd926..8ef435a82d 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -27,7 +27,7 @@ standardReleasePipeline { ) // Replace with publishToMaven(...) - fakeWithCredentials([usernamePassword(credentialsId: 'Sonatype', usernameVariable: 'SONATYPE_USERNAME', passwordVariable: 'SONATYPE_PASSWORD')]) { + fakeWithCredentials { sh('$WORKSPACE/publish/publish-snapshot.sh $WORKSPACE/dist/${distManifest.product}/maven') } From 10adfe0b7f5611ffe944e48864f26add5617015b Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:24:19 +0000 Subject: [PATCH 09/17] Play with signatures Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index 8ef435a82d..25fbdf606e 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -32,7 +32,7 @@ standardReleasePipeline { } // Replace with publishToArtifactRepositry(...) - fakeWithAWS(role: "${ARTIFACT_PROMOTION_ROLE_NAME}", roleAccount: "${AWS_ACCOUNT_ARTIFACT}", duration: 900, roleSessionName: 'jenkins-session') { + fakeWithAWS(role: 'ARTIFACT_PROMOTION_ROLE_NAME', roleAccount: 'AWS_ACCOUNT_ARTIFACT', duration: 900, roleSessionName: 'jenkins-session') { s3Upload(file: 'distribution/', bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${distManifest.product}/${distManifest.version}/") } From f05b0ba8e92348b9c1dfb4736b9ffbea162e2be0 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:24:59 +0000 Subject: [PATCH 10/17] Play with signatures Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index 25fbdf606e..f01301aa55 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -32,7 +32,7 @@ standardReleasePipeline { } // Replace with publishToArtifactRepositry(...) - fakeWithAWS(role: 'ARTIFACT_PROMOTION_ROLE_NAME', roleAccount: 'AWS_ACCOUNT_ARTIFACT', duration: 900, roleSessionName: 'jenkins-session') { + fakeWithAWS { s3Upload(file: 'distribution/', bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${distManifest.product}/${distManifest.version}/") } From 05b65ab8689f6af6575ad2e594b66345eed0c5a8 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:36:32 +0000 Subject: [PATCH 11/17] Add demo cleanup closure Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index f01301aa55..aa200ecb9d 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -14,7 +14,11 @@ lib = library( ]) ) -standardReleasePipeline { +Map args = [ + cleanup: { -> echo "Totally unneed clean for demo purposes"} +] + +standardReleasePipeline() { def distManifest = new FakeDistManifest(fakeYmlFromUrl(params.DistManifestUrl)) def downloadPath = fakeDownloadArtifacts(distManifest) @@ -44,6 +48,9 @@ standardReleasePipeline { ) } +///////////////////////////////////////////////////////////////////////////////////// +// Fakes were written to make sure POC could be executed against jenkins environment + class FakeDistManifest implements Serializable { // Additional contents need to be added to the dist manifest for // these parameters From d8ae325eb977da4e98ba285632b9fc8a89fe68e4 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:39:15 +0000 Subject: [PATCH 12/17] pass config parameters Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index aa200ecb9d..881a7f37ae 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -14,11 +14,11 @@ lib = library( ]) ) -Map args = [ +Map config = [ cleanup: { -> echo "Totally unneed clean for demo purposes"} ] -standardReleasePipeline() { +standardReleasePipeline(config) { def distManifest = new FakeDistManifest(fakeYmlFromUrl(params.DistManifestUrl)) def downloadPath = fakeDownloadArtifacts(distManifest) From 3f0a851930d678b7e11d2f87a6ed2832b4a4426d Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:47:55 +0000 Subject: [PATCH 13/17] Replace psuedo legit methods with proper wrappers Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 33 +++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index 881a7f37ae..ea85191a9b 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -23,28 +23,34 @@ standardReleasePipeline(config) { def downloadPath = fakeDownloadArtifacts(distManifest) - // Signing workflow fakeSignArtifacts( artifactsPath: downloadPath, signatureType: '.sig', distributionPlatform: 'linux', ) - // Replace with publishToMaven(...) - fakeWithCredentials { - sh('$WORKSPACE/publish/publish-snapshot.sh $WORKSPACE/dist/${distManifest.product}/maven') - } + fakePublishToMaven( + mavenArtifactsPath: "${downloadPath}/maven", + autoPublish: true + ) - // Replace with publishToArtifactRepositry(...) - fakeWithAWS { - s3Upload(file: 'distribution/', bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${distManifest.product}/${distManifest.version}/") + fakePublishToArtifactRepositry { + productName: distManifest.product, + version: distManifest.version, } fakeCopyDockerImage( sourceImagePath: distManifest.artifacts.containerReference, destinationImagePath: "opensearchproject/${distManifest.product}:${distManifest.version}", destinationType: "docker", - destinationCredentialIdentifier: "jenkins-staging-docker-prod-token" + destinationCredentialIdentifier: "opensearch-docker-prod" + ) + + fakeCopyDockerImage( + sourceImagePath: distManifest.artifacts.containerReference, + destinationImagePath: "opensearchproject/${distManifest.product}:${distManifest.version}", + destinationType: "ecr", + destinationCredentialIdentifier: "opensearch-ecr-prod" ) } @@ -79,19 +85,18 @@ Map fakeYmlFromUrl(String url) { def fakeDownloadArtifacts(FakeDistManifest manifest) { echo "fakeDownloadArtifacts" - } def fakeSignArtifacts(Map args) { echo "fakeDownloadArtifacts ${args}" } -def fakeWithCredentials(Closure closure) { - echo "fakeWithCredentials, not running inner closure" +def fakePublishToMaven(Map args) { + echo "fakePublishToMaven ${args}" } -def fakeWithAWS(Closure closure) { - echo "fakeWithAWS, not running inner closure" +def fakePublishToArtifactRepositry(Map args) { + echo "fakePublishToArtifactRepositry ${args}" } def fakeCopyDockerImage(Map args) { From 8cdefabf4856a71d01b236a9f12db1628bac5f62 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:49:33 +0000 Subject: [PATCH 14/17] Fix curly brace for parens Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index ea85191a9b..4e6d361c55 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -34,10 +34,10 @@ standardReleasePipeline(config) { autoPublish: true ) - fakePublishToArtifactRepositry { + fakePublishToArtifactRepositry( productName: distManifest.product, version: distManifest.version, - } + ) fakeCopyDockerImage( sourceImagePath: distManifest.artifacts.containerReference, From 1cbe5a5bd7d71acc2966321895219d30b72ea1a7 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 22:50:43 +0000 Subject: [PATCH 15/17] Fix function naming Signed-off-by: Peter Nied --- scripts/opensearch-build/release.jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/opensearch-build/release.jenkinsfile b/scripts/opensearch-build/release.jenkinsfile index 4e6d361c55..5d3906afd2 100644 --- a/scripts/opensearch-build/release.jenkinsfile +++ b/scripts/opensearch-build/release.jenkinsfile @@ -88,7 +88,7 @@ def fakeDownloadArtifacts(FakeDistManifest manifest) { } def fakeSignArtifacts(Map args) { - echo "fakeDownloadArtifacts ${args}" + echo "fakeSignArtifacts ${args}" } def fakePublishToMaven(Map args) { From 9f8cbd1187ff68a682c94dcf4f20a781611e66e5 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 4 Feb 2022 23:05:00 +0000 Subject: [PATCH 16/17] Delete slimmed down test jenkinsfile Signed-off-by: Peter Nied --- scripts/opensearch-build/release-test.jenkinsfile | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 scripts/opensearch-build/release-test.jenkinsfile diff --git a/scripts/opensearch-build/release-test.jenkinsfile b/scripts/opensearch-build/release-test.jenkinsfile deleted file mode 100644 index 74759600f5..0000000000 --- a/scripts/opensearch-build/release-test.jenkinsfile +++ /dev/null @@ -1,13 +0,0 @@ -lib = library( - identifier: 'jenkins@uni-poc', - retriever:modernSCM( - [$class: 'GitSCMSource', - credentialsId: '', - remote: 'https://github.com/peternied/opensearch-build.git', - traits: [gitBranchDiscovery()] - ]) - ) - -defaultPipeline { - echo "hello from this closure" -} \ No newline at end of file From 3922c55fddc5355753ea5cb814807baf42bac8ea Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Tue, 8 Feb 2022 21:44:23 +0000 Subject: [PATCH 17/17] Create a POC of how a release would be created Build up a github action to be triggered manually that could create a distribution manifest. This will not work as is, but is a possible forward path Signed-off-by: Peter Nied --- .github/workflows/start-release.yml | 80 +++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/start-release.yml diff --git a/.github/workflows/start-release.yml b/.github/workflows/start-release.yml new file mode 100644 index 0000000000..9b9a3cceca --- /dev/null +++ b/.github/workflows/start-release.yml @@ -0,0 +1,80 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Starts a data prepper release + +on: + workflow_dispatch: + +jobs: + r: + runs-on: ubuntu-latest + + steps: + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: Checkout Data-Prepper + uses: actions/checkout@v2 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + - name: Upload Coverage Report + uses: codecov/codecov-action@v1 + - name: Generate Javadocs + run: ./gradlew javadoc + + ## Upload the build artifact to s3 + - name: Upload build artifacts + uses: reggionick/s3-deploy@v3 + with: + folder: data-prepper-core/build/libs + bucket: ${{ secrets.S3_BUCKET }} + bucket-region: ${{ secrets.S3_BUCKET_REGION }} + delete-removed: false + + ## Create the docker image and upload it to data-prepper-staging, it houses continuous/nightly builds + - name: Build the Docker image + run: docker build . --file release/docker/Dockerfile --tag data-prepper:${{ VERSION }} + + ## Add the distribution manifest static file to the release artifacts + - name: Upload Jars to release + id: upload_release_jars + uses: softprops/action-gh-release@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: data-prepper-core/build/libs/data-prepper-core-${{ VERSION }}.tar.gz + asset_name: data-prepper-core-${{ VERSION }}.tar.gz + asset_content_type: application/tar+gzip + + ## Create the distribution manifest that will be used + - name: Create dist manifest + run: | + echo "---" > manifest.yml + echo "schema-version: '2.0'" >> manifest.yml + echo "build:" >> manifest.yml + echo " - name: Data-Prepper" >> manifest.yml + echo " version: ${{ VERSION }}" >> manifest.yml + echo "artifacts:" >> manifest.yml + echo " - location: https://${{ secrets.S3_BUCKET }}/data-prepper-core-${{ VERSION }}.tar.gz" >> manifest.yml + echo "containers:" >> manifest.yml + echo " - type: docker" >> manifest.yml + echo " tag: data-prepper-staging/data-prepper:${{ VERSION }}" >> manifest.yml + + ## Note for above artifacts, no platform / architecture is included because the artifacts are multi-platform/architecture + + ## Create a pull request to commit the manifest version into the codebase + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + author: opensearch-ci-bot + commit-message: | + Release manifest for ${{ VERSION }}. + + Signed-off-by: opensearch-ci-bot + delete-branch: true + title: '[AUTO] Release manifest for ${{ VERSION }}.' + body: | + A release has been triggered with this manifest. \ No newline at end of file