Skip to content
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

Force remove the existing distribution folder before move #384

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jacocoTestReport {
}
}

String version = '6.3.0'
String version = '6.3.1'

task updateVersion {
doLast {
Expand Down
4 changes: 2 additions & 2 deletions tests/jenkins/TestRetrievePreviousBuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class TestRetrievePreviousBuild extends BuildPipelineTest {
void testRetrievePreviousBuild() {
super.testPipeline('tests/jenkins/jobs/RetrievePreviousBuild_Jenkinsfile')
def shCommands = getCommands('sh', 'mkdir')
assertThat(shCommands, hasItems('mkdir -p tar && mv -v /tmp/workspace/download/dummy_job/2.12.0/123/linux/x64/tar/* /tmp/workspace/tar'))
assertThat(shCommands, hasItems('rm -rf tar && mkdir -p tar && mv -v /tmp/workspace/download/dummy_job/2.12.0/123/linux/x64/tar/* /tmp/workspace/tar'))
assertThat(shCommands, hasItems('mkdir -p ~/.m2/repository/org/ && cp -r tar/builds/opensearch/maven/org/opensearch/ ~/.m2/repository/org/'))

assertThat(shCommands, hasItems('mkdir -p zip && mv -v /tmp/workspace/download/dummy_job/2.12.0/1234/windows/x64/zip/* /tmp/workspace/zip'))
assertThat(shCommands, hasItems('rm -rf zip && mkdir -p zip && mv -v /tmp/workspace/download/dummy_job/2.12.0/1234/windows/x64/zip/* /tmp/workspace/zip'))
assertThat(shCommands, not(hasItems('mkdir -p ~/.m2/repository/org/ && cp -r zip/builds/opensearch/maven/org/opensearch/ ~/.m2/repository/org/')))

def s3DownloadCommands = getCommands('s3Download', 'bucket').findAll {
Expand Down
4 changes: 2 additions & 2 deletions tests/jenkins/jobs/RetrievePreviousBuild_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
downloadFromS3.withCredentials([AWS_ACCOUNT_NUMBER], groovy.lang.Closure)
downloadFromS3.withAWS({role=opensearch-bundle, roleAccount=AWS_ACCOUNT_NUMBER, duration=900, roleSessionName=jenkins-session, region=us-east-1}, groovy.lang.Closure)
downloadFromS3.s3Download({file=/tmp/workspace/download, bucket=ARTIFACT_BUCKET_NAME, path=dummy_job/2.12.0/123/linux/x64/tar/, force=true})
retrievePreviousBuild.sh(mkdir -p tar && mv -v /tmp/workspace/download/dummy_job/2.12.0/123/linux/x64/tar/* /tmp/workspace/tar)
retrievePreviousBuild.sh(rm -rf tar && mkdir -p tar && mv -v /tmp/workspace/download/dummy_job/2.12.0/123/linux/x64/tar/* /tmp/workspace/tar)
retrievePreviousBuild.echo(Setting up Maven Local for OpenSearch build.)
retrievePreviousBuild.sh(mkdir -p ~/.m2/repository/org/ && cp -r tar/builds/opensearch/maven/org/opensearch/ ~/.m2/repository/org/)
RetrievePreviousBuild_Jenkinsfile.retrievePreviousBuild({inputManifest=tests/data/opensearch-dashboards-input-2.12.0.yml, distribution=zip, architecture=x64, platform=windows, previousBuildId=1234})
Expand All @@ -30,4 +30,4 @@
downloadFromS3.withCredentials([AWS_ACCOUNT_NUMBER], groovy.lang.Closure)
downloadFromS3.withAWS({role=opensearch-bundle, roleAccount=AWS_ACCOUNT_NUMBER, duration=900, roleSessionName=jenkins-session, region=us-east-1}, groovy.lang.Closure)
downloadFromS3.s3Download({file=/tmp/workspace/download, bucket=ARTIFACT_BUCKET_NAME, path=dummy_job/2.12.0/1234/windows/x64/zip/, force=true})
retrievePreviousBuild.sh(mkdir -p zip && mv -v /tmp/workspace/download/dummy_job/2.12.0/1234/windows/x64/zip/* /tmp/workspace/zip)
retrievePreviousBuild.sh(rm -rf zip && mkdir -p zip && mv -v /tmp/workspace/download/dummy_job/2.12.0/1234/windows/x64/zip/* /tmp/workspace/zip)
2 changes: 1 addition & 1 deletion vars/retrievePreviousBuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void call(Map args = [:]) {
force: true,
)
}
sh("mkdir -p ${distribution} && mv -v ${prefixPath}/${artifactPath}/* ${WORKSPACE}/${distribution}")
sh("rm -rf ${distribution} && mkdir -p ${distribution} && mv -v ${prefixPath}/${artifactPath}/* ${WORKSPACE}/${distribution}")
if (inputManifestObj.build.getFilename().equals("opensearch")) {
echo("Setting up Maven Local for OpenSearch build.")
sh("mkdir -p ~/.m2/repository/org/ && cp -r ${distribution}/builds/opensearch/maven/org/opensearch/ ~/.m2/repository/org/")
Expand Down
Loading