Skip to content

Commit

Permalink
Improve Debian Releases File (#426)
Browse files Browse the repository at this point in the history
Signed-off-by: marcohald <marco.hald@usu.com>
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
Co-authored-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
marcohald and peterzhuamazon authored May 22, 2024
1 parent 302c63c commit 3632e49
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tests/jenkins/TestPromoteRepos.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class TestPromoteRepos extends BuildPipelineTest {
runScript("tests/jenkins/jobs/PromoteRepos_Jenkinsfile")
assertThat(getShellCommands('sh', 'curl'), hasItems('\n set -e\n set +x\n\n echo \"Pulling 1.3.0 deb\"\n cd /tmp/workspace/artifacts/releases/bundle/opensearch/1.x/apt\n curl -SLO https://ci.opensearch.org/dbc/opensearch/1.3.0/123/linux/x64/deb/dist/opensearch/opensearch-1.3.0-linux-x64.deb\n curl -SLO https://ci.opensearch.org/dbc/opensearch/1.3.0/123/linux/arm64/deb/dist/opensearch/opensearch-1.3.0-linux-arm64.deb\n\n ls -l\n '))
assertThat(getShellCommands('sh', 'aws'), hasItems('aws s3 sync s3://ARTIFACT_PRODUCTION_BUCKET_NAME/releases/bundle/opensearch/1.x/apt/ /tmp/workspace/artifacts/releases/bundle/opensearch/1.x/apt/ --no-progress'))
assertThat(getShellCommands('sh', 'aptly'), hasItems('#!/bin/bash\n\n set -e\n set +x\n\n ARTIFACT_PATH=\"/tmp/workspace/artifacts/releases/bundle/opensearch/1.x/apt\"\n\n echo \"Start Signing Apt\"\n rm -rf ~/.aptly\n mkdir $ARTIFACT_PATH/base\n find $ARTIFACT_PATH -type f -name \"*.deb\" | xargs -I {} mv -v {} $ARTIFACT_PATH/base\n aptly repo create -distribution=stable -component=main opensearch\n aptly repo add opensearch $ARTIFACT_PATH/base\n aptly repo show -with-packages opensearch\n aptly snapshot create opensearch-1.x from repo opensearch\n aptly publish snapshot -batch=true -passphrase-file=passphrase opensearch-1.x\n echo \"------------------------------------------------------------------------\"\n echo \"Clean up gpg\"\n gpg --batch --yes --delete-secret-keys RPM_SIGNING_KEY_ID\n gpg --batch --yes --delete-keys RPM_SIGNING_KEY_ID\n rm -v passphrase\n echo \"------------------------------------------------------------------------\"\n rm -rf $ARTIFACT_PATH/*\n cp -rvp ~/.aptly/public/* $ARTIFACT_PATH/\n ls $ARTIFACT_PATH\n\n '))
def aptly_str="#!/bin/bash\n\n set -e\n set +x\n\n ARTIFACT_PATH=\"/tmp/workspace/artifacts/releases/bundle/opensearch/1.x/apt\"\n\n echo \"Start Signing Apt\"\n rm -rf ~/.aptly\n mkdir \$ARTIFACT_PATH/base\n find \$ARTIFACT_PATH -type f -name \"*.deb\" | xargs -I {} mv -v {} \$ARTIFACT_PATH/base\n aptly repo create -comment=\"opensearch repository\" -distribution=stable -component=main opensearch\n aptly repo add opensearch \$ARTIFACT_PATH/base\n aptly repo show -with-packages opensearch\n aptly snapshot create opensearch-1.x from repo opensearch\n aptly publish snapshot -label=\"opensearch\" -origin=\"artifacts.opensearch.org\" -batch=true -passphrase-file=passphrase opensearch-1.x\n echo \"------------------------------------------------------------------------\"\n echo \"Clean up gpg\"\n gpg --batch --yes --delete-secret-keys RPM_SIGNING_KEY_ID\n gpg --batch --yes --delete-keys RPM_SIGNING_KEY_ID\n rm -v passphrase\n echo \"------------------------------------------------------------------------\"\n rm -rf \$ARTIFACT_PATH/*\n cp -rvp ~/.aptly/public/* \$ARTIFACT_PATH/\n ls \$ARTIFACT_PATH\n\n "
assertThat(getShellCommands('sh', 'aptly'), hasItems(aptly_str))
}

def getShellCommands(methodName, searchString) {
Expand Down
4 changes: 2 additions & 2 deletions tests/jenkins/jobs/PromoteRepos_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@
rm -rf ~/.aptly
mkdir $ARTIFACT_PATH/base
find $ARTIFACT_PATH -type f -name "*.deb" | xargs -I {} mv -v {} $ARTIFACT_PATH/base
aptly repo create -distribution=stable -component=main opensearch
aptly repo create -comment="opensearch repository" -distribution=stable -component=main opensearch
aptly repo add opensearch $ARTIFACT_PATH/base
aptly repo show -with-packages opensearch
aptly snapshot create opensearch-1.x from repo opensearch
aptly publish snapshot -batch=true -passphrase-file=passphrase opensearch-1.x
aptly publish snapshot -label="opensearch" -origin="artifacts.opensearch.org" -batch=true -passphrase-file=passphrase opensearch-1.x
echo "------------------------------------------------------------------------"
echo "Clean up gpg"
gpg --batch --yes --delete-secret-keys RPM_SIGNING_KEY_ID
Expand Down
4 changes: 2 additions & 2 deletions vars/promoteRepos.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ void call(Map args = [:]) {
rm -rf ~/.aptly
mkdir \$ARTIFACT_PATH/base
find \$ARTIFACT_PATH -type f -name "*.deb" | xargs -I {} mv -v {} \$ARTIFACT_PATH/base
aptly repo create -distribution=stable -component=main ${jobname}
aptly repo create -comment="${filename} repository" -distribution=stable -component=main ${jobname}
aptly repo add ${jobname} \$ARTIFACT_PATH/base
aptly repo show -with-packages ${jobname}
aptly snapshot create ${jobname}-${repoVersion} from repo ${jobname}
aptly publish snapshot -batch=true -passphrase-file=passphrase ${jobname}-${repoVersion}
aptly publish snapshot -label="${filename}" -origin="artifacts.opensearch.org" -batch=true -passphrase-file=passphrase ${jobname}-${repoVersion}
echo "------------------------------------------------------------------------"
echo "Clean up gpg"
gpg --batch --yes --delete-secret-keys ${RPM_SIGNING_KEY_ID}
Expand Down

0 comments on commit 3632e49

Please sign in to comment.