Skip to content

Commit d6281a0

Browse files
committed
[GHA] TPE signing service adoption
1 parent c824872 commit d6281a0

File tree

3 files changed

+105
-62
lines changed

3 files changed

+105
-62
lines changed

.github/scripts/sign-exe-in-zip-file.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ echo "Successfully extracted ${filename}"
1818
sts_folder=`find ./${destination_folder_name} -maxdepth 1 -type d -name 'sts-*' -print -quit`
1919
echo "Found STS distro folder: ${sts_folder}"
2020
echo "About to sign win exe file: ${sts_folder}/SpringToolSuite4.exe (id = ${id})"
21-
$sign_script ${sts_folder}/SpringToolSuite4.exe ${sts_folder}/SpringToolSuite4.exe $id
21+
$sign_script ${sts_folder}/SpringToolSuite4.exe ${sts_folder}/SpringToolSuite4.exe "${id}-${filename%.*}" 30
2222
echo "Adding to zip contents of a folder ${destination_folder_name}"
2323
cd ${destination_folder_name}
2424
zip -r -q ../$file .

.github/scripts/sign-exe.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@ set -e
22
in_file=$1
33
out_file=$2
44
id=$3
5+
wait_time=$4
56

67
in_filename="$(basename -- $in_file)"
7-
echo "Setting up folder ${id} on the remote machine"
8-
ssh -i $SSH_KEY $SSH_USER@vm-tools.spring.vmware.com -- mkdir /opt/bamboo/$id
9-
echo "Copying $in_filename to remote machine into /opt/bamboo/${id}..."
10-
scp -i $SSH_KEY $in_file $SSH_USER@vm-tools.spring.vmware.com:/opt/bamboo/$id
11-
echo "Signing $in_filename..."
12-
ssh -i $SSH_KEY $SSH_USER@vm-tools.spring.vmware.com -- /build/apps/signing/signserver/signc -v --input=/opt/bamboo/$id/$in_filename --keyid=authenticode_SHA2 --signmethod="winddk-8.1" --output=/opt/bamboo/$id/$in_filename --hash sha256
13-
echo "Copying **signed** $in_filename back... (into $out_file)"
14-
scp -i $SSH_KEY $SSH_USER@vm-tools.spring.vmware.com:/opt/bamboo/$id/$in_filename $out_file
15-
echo "Cleaning up remote machine..."
16-
ssh -i $SSH_KEY $SSH_USER@vm-tools.spring.vmware.com -- rm -rf /opt/bamboo/$id
17-
echo "Successfully signed $in_filename"
8+
echo "Copying ${in_file} to s3 s3://${AWS_S3_BUCKET}/exes-to-sign/${id}.exe for signing"
9+
aws s3 cp $in_file s3://$AWS_S3_BUCKET/exes-to-sign/$id.exe
10+
for i in {1..10}
11+
do
12+
wait $wait_time
13+
aws s3api head-object --bucket $CDN_BUCKET --key spring-tools/exes-signed/$id.exe || NOT_EXIST=true
14+
if [ $NOT_EXIST ]; then
15+
echo "Waited ${wait_time} seconds but ${in_filename} hasn't been signed yet..."
16+
else
17+
echo "Successfully signed file ${in_filename}"
18+
break
19+
fi
20+
done
21+
aws mv s3://$AWS_S3_BUCKET/exes-signed/$id.exe $out_file
1822

.github/workflows/gh-hosted-eclipse-distro-build.yml

Lines changed: 89 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -153,57 +153,96 @@ jobs:
153153
p2_path: ${{ steps.s3-paths.outputs.p2_path }}
154154
version: ${{ steps.project-version.outputs.version }}
155155

156+
sign-win-distros:
157+
needs: [ eclipse-distro-build ]
158+
runs-on: ubuntu-latest
159+
steps:
160+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
161+
with:
162+
sparse-checkout: |
163+
.github
164+
- name: Download Win Zips from S3 for Signing
165+
run: |
166+
rm -f spring-tool-suite-4*win*.zip*
167+
rm -f spring-tool-suite-4*win*.self-extracting.jar*
168+
ls
169+
aws s3 mv s3://$AWS_S3_BUCKET/sts4-distro-ci-temp/${{ needs.eclipse-distro-build.outputs.id }} . --recursive --exclude "*" --include "spring-tool-suite-4*win*.zip*" --exclude "*/*"
170+
- name: Sign EXE within zip files
171+
id: sign
172+
run: |
173+
files=`ls spring-tool-suite-4*win*.zip`
174+
for file in $files
175+
do
176+
${{ github.workspace }}/.github/scripts/sign-exe-in-zip-file.sh $file ${{ github.workspace }}/.github/scripts/sign-exe.sh ${{ github.workspace }}/.github/scripts/self-extracting-jar-creator.jar ${{ github.run_id }}
177+
done
178+
- name: Update Win zip/jar on S3
179+
id: update-s3
180+
run: |
181+
dist_path=${{ needs.eclipse-distro-build.outputs.dist_path }}
182+
echo "Processing S3 update..."
183+
ls spring-tool-suite-4*win*
184+
echo "Removing old win zip and self extracting jar files from S3..."
185+
aws s3 rm s3://$AWS_S3_BUCKET/${dist_path} --recursive --exclude "*" --include "spring-tool-suite-4*win*.zip*" --include "spring-tool-suite-4*win*.self-extracting.jar*" --exclude "*/*"
186+
echo "Uploading new win zip and self extracting jar files to S3..."
187+
aws s3 mv . s3://$AWS_S3_BUCKET/${dist_path} --recursive --exclude "*" --include "spring-tool-suite-4*win*.zip*" --include "spring-tool-suite-4*win*.self-extracting.jar*" --exclude "*/*" --no-progress
188+
- name: Update Nightly Distro Downloads page
189+
if: ${{ inputs.build_type == 'snapshot' }}
190+
run: |
191+
dist_path=${{ needs.eclipse-distro-build.outputs.dist_path }}
192+
eclipse_profile=${{ inputs.eclipse_profile }}
193+
eclipse_version=${eclipse_profile:0:2}.${eclipse_profile:2}
194+
${{ github.workspace }}/.github/scripts/update-distro-download-page.sh $dist_path $eclipse_version ${{ inputs.build_type }} $AWS_S3_BUCKET $DOWNLOAD_URL_ROOT
156195
157-
sign-win-distros:
158-
needs: [ eclipse-distro-build ]
159-
runs-on: [ self-hosted, Linux ]
160-
steps:
161-
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
162-
with:
163-
sparse-checkout: |
164-
.github
165-
- name: Download Win Zips from S3 for Signing
166-
run: |
167-
rm -f spring-tool-suite-4*win*.zip*
168-
rm -f spring-tool-suite-4*win*.self-extracting.jar*
169-
ls
170-
aws s3 mv s3://$AWS_S3_BUCKET/sts4-distro-ci-temp/${{ needs.eclipse-distro-build.outputs.id }} . --recursive --exclude "*" --include "spring-tool-suite-4*win*.zip*" --exclude "*/*"
171-
- name: Sign EXE within zip files
172-
id: sign
173-
env:
174-
SSH_KEY: ~/.ssh/id_rsa
175-
SSH_USER: signer
176-
run: |
177-
files=`ls spring-tool-suite-4*win*.zip`
178-
for file in $files
179-
do
180-
${{ github.workspace }}/.github/scripts/sign-exe-in-zip-file.sh $file ${{ github.workspace }}/.github/scripts/sign-exe.sh ${{ github.workspace }}/.github/scripts/self-extracting-jar-creator.jar ${{ needs.eclipse-distro-build.outputs.id }}
181-
done
182-
- name: Update Win zip/jar on S3
183-
id: update-s3
184-
run: |
185-
dist_path=${{ needs.eclipse-distro-build.outputs.dist_path }}
186-
echo "Processing S3 update..."
187-
ls spring-tool-suite-4*win*
188-
echo "Removing old win zip and self extracting jar files from S3..."
189-
aws s3 rm s3://$AWS_S3_BUCKET/${dist_path} --recursive --exclude "*" --include "spring-tool-suite-4*win*.zip*" --include "spring-tool-suite-4*win*.self-extracting.jar*" --exclude "*/*"
190-
echo "Uploading new win zip and self extracting jar files to S3..."
191-
aws s3 mv . s3://$AWS_S3_BUCKET/${dist_path} --recursive --exclude "*" --include "spring-tool-suite-4*win*.zip*" --include "spring-tool-suite-4*win*.self-extracting.jar*" --exclude "*/*" --no-progress
192-
- name: Update Nightly Distro Downloads page
193-
if: ${{ inputs.build_type == 'snapshot' }}
194-
run: |
195-
dist_path=${{ needs.eclipse-distro-build.outputs.dist_path }}
196-
eclipse_profile=${{ inputs.eclipse_profile }}
197-
eclipse_version=${eclipse_profile:0:2}.${eclipse_profile:2}
198-
${{ github.workspace }}/.github/scripts/update-distro-download-page.sh $dist_path $eclipse_version ${{ inputs.build_type }} $AWS_S3_BUCKET $DOWNLOAD_URL_ROOT
199-
- name: Cleanup
200-
if: ${{ always() }}
201-
env:
202-
SSH_KEY: ~/.ssh/id_rsa
203-
SSH_USER: signer
204-
run: |
205-
ssh -i $SSH_KEY [email protected] -- rm -rf /opt/bamboo/${{ needs.eclipse-distro-build.outputs.id }}
206-
rm -rf *spring-tool-suite-4*win*
196+
# sign-win-distros:
197+
# needs: [ eclipse-distro-build ]
198+
# runs-on: [ self-hosted, Linux ]
199+
# steps:
200+
# - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
201+
# with:
202+
# sparse-checkout: |
203+
# .github
204+
# - name: Download Win Zips from S3 for Signing
205+
# run: |
206+
# rm -f spring-tool-suite-4*win*.zip*
207+
# rm -f spring-tool-suite-4*win*.self-extracting.jar*
208+
# ls
209+
# aws s3 mv s3://$AWS_S3_BUCKET/sts4-distro-ci-temp/${{ needs.eclipse-distro-build.outputs.id }} . --recursive --exclude "*" --include "spring-tool-suite-4*win*.zip*" --exclude "*/*"
210+
# - name: Sign EXE within zip files
211+
# id: sign
212+
# env:
213+
# SSH_KEY: ~/.ssh/id_rsa
214+
# SSH_USER: signer
215+
# run: |
216+
# files=`ls spring-tool-suite-4*win*.zip`
217+
# for file in $files
218+
# do
219+
# ${{ github.workspace }}/.github/scripts/sign-exe-in-zip-file.sh $file ${{ github.workspace }}/.github/scripts/sign-exe.sh ${{ github.workspace }}/.github/scripts/self-extracting-jar-creator.jar ${{ needs.eclipse-distro-build.outputs.id }}
220+
# done
221+
# - name: Update Win zip/jar on S3
222+
# id: update-s3
223+
# run: |
224+
# dist_path=${{ needs.eclipse-distro-build.outputs.dist_path }}
225+
# echo "Processing S3 update..."
226+
# ls spring-tool-suite-4*win*
227+
# echo "Removing old win zip and self extracting jar files from S3..."
228+
# aws s3 rm s3://$AWS_S3_BUCKET/${dist_path} --recursive --exclude "*" --include "spring-tool-suite-4*win*.zip*" --include "spring-tool-suite-4*win*.self-extracting.jar*" --exclude "*/*"
229+
# echo "Uploading new win zip and self extracting jar files to S3..."
230+
# aws s3 mv . s3://$AWS_S3_BUCKET/${dist_path} --recursive --exclude "*" --include "spring-tool-suite-4*win*.zip*" --include "spring-tool-suite-4*win*.self-extracting.jar*" --exclude "*/*" --no-progress
231+
# - name: Update Nightly Distro Downloads page
232+
# if: ${{ inputs.build_type == 'snapshot' }}
233+
# run: |
234+
# dist_path=${{ needs.eclipse-distro-build.outputs.dist_path }}
235+
# eclipse_profile=${{ inputs.eclipse_profile }}
236+
# eclipse_version=${eclipse_profile:0:2}.${eclipse_profile:2}
237+
# ${{ github.workspace }}/.github/scripts/update-distro-download-page.sh $dist_path $eclipse_version ${{ inputs.build_type }} $AWS_S3_BUCKET $DOWNLOAD_URL_ROOT
238+
# - name: Cleanup
239+
# if: ${{ always() }}
240+
# env:
241+
# SSH_KEY: ~/.ssh/id_rsa
242+
# SSH_USER: signer
243+
# run: |
244+
# ssh -i $SSH_KEY [email protected] -- rm -rf /opt/bamboo/${{ needs.eclipse-distro-build.outputs.id }}
245+
# rm -rf *spring-tool-suite-4*win*
207246

208247
sign-osx-distros:
209248
needs: [ eclipse-distro-build ]

0 commit comments

Comments
 (0)