Skip to content

Commit

Permalink
Fancy html report
Browse files Browse the repository at this point in the history
Signed-off-by: David Blevins <david.blevins@gmail.com>
  • Loading branch information
dblevins committed Aug 17, 2019
1 parent c31b0b0 commit 17c118f
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 32 deletions.
37 changes: 5 additions & 32 deletions promotion/promote-release.sh
Expand Up @@ -3,6 +3,7 @@
##[ Imports ]####################

source "$(dirname $0)/utils.sh"
source "$(dirname $0)/report.sh"

##[ Required Environment ]#######

Expand Down Expand Up @@ -36,6 +37,9 @@ require FILE_URL "https?://download.eclipse.org/.*\.(zip|tar.gz|pdf|jar|war|ear)
# If the tck starts with "eclipse-" rename it "jakarta-"
[[ $FILE == eclipse-* ]] && cp $FILE ${FILE/eclipse-/jakarta-}

# Our list of files before we start signing
FILES=($(ls))

( # Hash and sign

for file in *; do
Expand Down Expand Up @@ -97,37 +101,6 @@ require FILE_URL "https?://download.eclipse.org/.*\.(zip|tar.gz|pdf|jar|war|ear)
# Record the public key
gpg --armor --export 'jakarta.ee-spec@eclipse.org' > "$WORKSPACE/jakarta.ee-spec.pub"

( # Create an audit.txt for tracing
echo "
-------------------------------------
DATE : $(date)
SPEC_NAME : $SPEC_NAME
SPEC_VERSION : $SPEC_VERSION
FILE_URL : $FILE_URL
-------------------------------------
PROMOTED FILES:
"
# Print a list files we've signed and their hash
for sig in *.sig; do file="${sig/.sig/}"; hash="${sig/.sig/.sha256}"; echo "
- https://download.eclipse.org/jakartaee/${SPEC_NAME}/${SPEC_VERSION}/$file
$(cat $hash)
"; done

# Print the signatures themselves
for sig in *.sig; do echo "
$sig
$(cat $sig)
"; done

echo "
-------------------------------------
JAKARTA EE PUBLIC KEY
$(gpg --armor --export 'jakarta.ee-spec@eclipse.org')
"
) > "$WORKSPACE/audit.txt"

# Add a download link we can see in the Jenkins job results
echo "<html><head><meta http-equiv=\"Refresh\" content=\"0; url=https://download.eclipse.org/jakartaee/${SPEC_NAME}/${SPEC_VERSION}/\" /></head></html>" > "$WORKSPACE/View-Files.html"
report "${FILES[@]}" > "$WORKSPACE/${SPEC_NAME}-${SPEC_VERSION}.html"

)
151 changes: 151 additions & 0 deletions promotion/report.sh
@@ -0,0 +1,151 @@
#!/bin/bash

function report {
cat <<HTML
<html>
<head>
<style>
body {
background-color: white;
font-family: Lato;
margin-left: 35px;
margin-top: 15px;
}
.name {
display: inline-block;
width: 150px;
}
.value {
display: inline;
}
.hash, pre {
font-size: 15px;
font-family: "Roboto Mono", Menlo;
}
a {
text-decoration: none;
color: #3c3c3c;
}
.file, .hash, .signature {
color: black;
margin-bottom: 10px;
display: inline-block;
}
.file {
margin-bottom: 15px;
text-decoration: none;
font-size: 20px;
color: #3c3c3c;
font-weight: 400;
-webkit-font-smoothing: antialiased;
}
.files {
margin-bottom: 20px;
}
.input {
margin-bottom: 10px;
}
.hash {
padding-left: 10px;
border-left: 4px solid #d63aff;
color: #d63aff;
background: #d63aff24;
width: 588px;
padding-top: 7px;
padding-bottom: 7px;
}
.signature {
border-left: 4px solid #00b9f1;
margin-top: 10px;
background: #00b9f124;
}
.release {
font-size: 30px;
font-weight: 300;
margin-bottom: 30px;
}
pre {
margin: 0px;
/* background: #eaeaea; */
padding: 10px;
display: inline-flex;
color: #00b9f1;
}
h2 {
margin-left: -10px;
}
</style>
</head>
<body>
<h2>DATE</h2>
<div>$(date)</div>
<h2>INPUT</h2>
<div class="run">
<div class="input">
<div class="name">SPEC_NAME</div>
<div class="value">$SPEC_NAME</div>
</div>
<div class="input">
<div class="name">SPEC_VERSION</div>
<div class="value">$SPEC_VERSION</div>
</div>
<div class="input">
<div class="name">FILE_URL</div>
<div class="value">$FILE_URL</div>
</div>
</div>
<h2>RELEASE</h2>
<div class="release">
<a href="https://download.eclipse.org/jakartaee/$SPEC_NAME/$SPEC_VERSION/">https://download.eclipse.org/jakartaee/$SPEC_NAME/$SPEC_VERSION/</a>
</div>
<h2>PROMOTED FILES</h2>
HTML

for file in "$@"; do
cat <<HTML
<div class="files">
<div>
<div class="file">
<a href="https://download.eclipse.org/jakartaee/$SPEC_NAME/$SPEC_VERSION/$file">$file</a>
</div>
</div>
<div>
<div class="hash">$(cat $file.sha256)</div>
</div>
<div>
<div class="signature"><pre>$(cat $file.sig)</pre>
</div>
</div>
</div>
HTML
done

cat <<HTML
<h2>JAKARTA EE PUBLIC KEY</h2>
<div class="publickey">
<pre>$(gpg --armor --export 'jakarta.ee-spec@eclipse.org')</pre>
</div>
</body>
</html>
HTML
}

0 comments on commit 17c118f

Please sign in to comment.