[Apple notarization] publish developer log on notarization failure

GitOrigin-RevId: fdced2ac53449654f4e352dbea770bdaa684ba64
This commit is contained in:
Dmitriy.Panov
2019-07-02 06:52:16 +03:00
committed by intellij-monorepo-bot
parent 9defad9c29
commit 1372de2b19
2 changed files with 27 additions and 7 deletions
@@ -20,6 +20,7 @@ class MacDmgBuilder {
private final MacHostProperties macHostProperties
private final String remoteDir
private final MacDistributionCustomizer customizer
private static final def ENV_FOR_MAC_BUILDER = ['APPL_USER', 'APPL_PASSWORD', 'ARTIFACTORY_API_KEY', 'ARTIFACTORY_URL']
private MacDmgBuilder(BuildContext buildContext, MacDistributionCustomizer customizer, String remoteDir, MacHostProperties macHostProperties) {
this.customizer = customizer
@@ -199,7 +200,15 @@ class MacDmgBuilder {
if (jreArchivePath != null) {
args += '"' + PathUtilRt.getFileName(jreArchivePath) + '"'
}
sshExec("$remoteDir/signapp.sh ${args.join(" ")}", "signapp.log")
def env = ''
ENV_FOR_MAC_BUILDER.each {
def value = System.getenv(it)
if (value != null && !value.isEmpty()) {
env << "$it=$value "
}
}
sshExec("$env$remoteDir/signapp.sh ${args.join(" ")}", "signapp.log")
buildContext.messages.progress("Downloading signed ${targetFile.name} from ${macHostProperties.host}")
ant.delete(file: targetFile.path)
@@ -18,6 +18,12 @@ function log() {
echo "$(date '+[%H:%M:%S]') $*"
}
function publish-log() {
id=$1
file=$2
curl -H "X-JFrog-Art-Api: $ARTIFACTORY_API_KEY" -T "$file" "$ARTIFACTORY_URL/$id"
}
#immediately exit script with an error if a command fails
set -euo pipefail
@@ -59,7 +65,7 @@ while true; do
log "Notarization failed"
ec=1
elif [ "$status" = "success" ]; then
log "Notarization suceed"
log "Notarization succeeded"
ec=0
else
if [ "$status" != "in progress" ]; then
@@ -75,11 +81,16 @@ while true; do
((spent += 1))
continue
fi
log "Fetching developer_log.json"
url="$(grep -oe 'LogFileURL: .*' "altool.check.out" | cut -c 12-)"
wget "$url" -O "developer_log.json" && cat "developer_log.json" || true
# TODO: publish developer_log.json
developer_log="developer_log.json"
log "Fetching $developer_log"
url=$(grep -oe 'LogFileURL: .*' "altool.check.out" | cut -c 12-)
# wget does url quoting by itself
# shellcheck disable=SC2086
wget $url -O "$developer_log" && cat "$developer_log" || true
if [ $ec != 0 ]; then
log "Publishing $developer_log"
publish-log "$notarization_info" "$developer_log"
fi
break
done
cat "altool.check.out"