Skip to content

Commit

Permalink
Publish MD5 and SHA1 signatures (backport to 1.1). (#72)
Browse files Browse the repository at this point in the history
* Publish MD5 and SHA1 signatures.

Signed-off-by: dblock <[email protected]>

* Also publish 256 and 512 checksums.

Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock authored Oct 7, 2021
1 parent 0a4ce10 commit a7c09d4
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 61 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/push-job-sched-jar.yml

This file was deleted.

68 changes: 68 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash

# 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.

set -ex

function usage() {
echo "Usage: $0 [args]"
echo ""
echo "Arguments:"
echo -e "-v VERSION\t[Required] OpenSearch version."
echo -e "-s SNAPSHOT\t[Optional] Build a snapshot, default is 'false'."
echo -e "-a ARCHITECTURE\t[Optional] Build architecture, ignored."
echo -e "-o OUTPUT\t[Optional] Output path, default is 'artifacts'."
echo -e "-h help"
}

while getopts ":h:v:s:o:a:" arg; do
case $arg in
h)
usage
exit 1
;;
v)
VERSION=$OPTARG
;;
s)
SNAPSHOT=$OPTARG
;;
o)
OUTPUT=$OPTARG
;;
a)
ARCHITECTURE=$OPTARG
;;
:)
echo "Error: -${OPTARG} requires an argument"
usage
exit 1
;;
?)
echo "Invalid option: -${arg}"
exit 1
;;
esac
done

if [ -z "$VERSION" ]; then
echo "Error: You must specify the OpenSearch version"
usage
exit 1
fi

[[ "$SNAPSHOT" == "true" ]] && VERSION=$VERSION-SNAPSHOT
[ -z "$OUTPUT" ] && OUTPUT=artifacts

./gradlew publishShadowPublicationToMavenLocal -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT
mkdir -p $OUTPUT/maven/org/opensearch
cp -r ./spi/build/distributions/* $OUTPUT/maven/org/opensearch

./gradlew assemble --no-daemon --refresh-dependencies -DskipTests=true -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT
[ -z "$OUTPUT" ] && OUTPUT=artifacts
mkdir -p $OUTPUT/plugins
cp ./build/distributions/*.zip $OUTPUT/plugins
26 changes: 9 additions & 17 deletions spi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ shadowJar {
classifier = null
}

tasks.withType(Jar) { task ->
task.doLast {
ant.checksum algorithm: 'md5', file: it.archivePath
ant.checksum algorithm: 'sha1', file: it.archivePath
ant.checksum algorithm: 'sha-256', file: it.archivePath, fileext: '.sha256'
ant.checksum algorithm: 'sha-512', file: it.archivePath, fileext: '.sha512'
}
}

test {
doFirst {
// reverse operation of https://github.com/elastic/elasticsearch/blob/7.6/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy#L736-L743
Expand Down Expand Up @@ -146,24 +155,7 @@ publishing {
}
}

repositories {
maven {
name = "sonatype-staging"
url "https://aws.oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
username project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : ''
password project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : ''
}
}
}

// TODO - enabled debug logging for the time being, remove this eventually
gradle.startParameter.setShowStacktrace(ShowStacktrace.ALWAYS)
gradle.startParameter.setLogLevel(LogLevel.DEBUG)
}

signing {
required { gradle.taskGraph.hasTask("publishShadowPublicationToSonatype-stagingRepository") }
sign publishing.publications.shadow
}

0 comments on commit a7c09d4

Please sign in to comment.