Skip to content

Commit

Permalink
Jenkins: fix unbound S3_BUCKET_ACL
Browse files Browse the repository at this point in the history
* previous MR was merged so fast that the test build didn't even
  start before that, fix unbound S3_BUCKET_ACL and counting of BUNDLEs
* fix shebangs in upload-bundles*.sh to bash as other scripts are
  using, we have (useless) "function" bashism inside, so lets not
  claim /bin/sh compatiblity
  • Loading branch information
shr-project authored and EricBoiseLGSVL committed Sep 17, 2021
1 parent 5f5ae92 commit ce4d54e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions Jenkins/Jenkinsfile-Bundles
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pipeline {
DISPLAY = ":0"
JENKINS_BUILD_ID = "${BUILD_ID}"
S3_DOWNLOAD_HOST = "${S3_DOWNLOAD_HOST}/v2"
S3_BUCKET_ACL = "--acl public-read"
}

stages {
Expand Down Expand Up @@ -363,7 +362,7 @@ pipeline {
withCredentials([[credentialsId: "${S3_CREDENTIALS_ID}", accessKeyVariable: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY', $class: 'AmazonWebServicesCredentialsBinding']]) {
dir("Jenkins") {
sh """
UID=`id -u` docker-compose run --rm upload-bundles | tee ../upload-bundles.log
UID=`id -u` S3_BUCKET_ACL="--acl public-read" docker-compose run --rm upload-bundles | tee ../upload-bundles.log
# exit PIPESTATUS[0] cannot be used because of:
# groovy.lang.MissingPropertyException: No such property: PIPESTATUS for class: groovy.lang.Binding
exit `grep ^upload.failed: ../upload-bundles.log | wc -l`
Expand Down
3 changes: 1 addition & 2 deletions Jenkins/Jenkinsfile-Bundles-Release
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ pipeline {
GIT_TAG = "${GIT_TAG}"
S3_DOWNLOAD_HOST = "${S3_RELEASE_DOWNLOAD_HOST}"
S3_BUCKET_NAME = "${S3_RELEASE_BUCKET_NAME}"
S3_BUCKET_ACL = ""
}

stages {
Expand Down Expand Up @@ -365,7 +364,7 @@ pipeline {
withCredentials([[credentialsId: "${S3_CREDENTIALS_ID}", accessKeyVariable: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY', $class: 'AmazonWebServicesCredentialsBinding']]) {
dir("Jenkins") {
sh """
UID=`id -u` docker-compose run --rm upload-bundles | tee ../upload-bundles.log
UID=`id -u` S3_BUCKET_ACL="" docker-compose run --rm upload-bundles | tee ../upload-bundles.log
# exit PIPESTATUS[0] cannot be used because of:
# groovy.lang.MissingPropertyException: No such property: PIPESTATUS for class: groovy.lang.Binding
exit `grep ^upload.failed: ../upload-bundles.log | wc -l`
Expand Down
5 changes: 4 additions & 1 deletion Jenkins/build-bundles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ function build_bundle {
# Move the source for individual bundles from Assets/External-All to Assets/External
# to prevent Unity importing all the available assets when we went to build just one
# of them
BUNDLE=$(expr ${BUNDLE} + 1)
echo "Building bundle (${BUNDLE}/${BUNDLES}) $*"
if [ ! -d .external-assets/$1/$2 ] ; then
echo "ERROR: Bundle source doesn't exist in .external-assets/$1/$2"
Expand Down Expand Up @@ -172,26 +171,30 @@ BUNDLE=0
if [ ! -z ${SIM_ENVIRONMENTS+x} ]; then
getAssets "${SIM_ENVIRONMENTS}"
for A in ${ASSETS}; do
BUNDLE=$(expr ${BUNDLE} + 1)
build_bundle Environments ${A} 2>&1 | tee -a unity-build-bundles-Environments.log
done
fi
if [ ! -z ${SIM_VEHICLES+x} ]; then
getAssets "${SIM_VEHICLES}"
for A in ${ASSETS}; do
BUNDLE=$(expr ${BUNDLE} + 1)
build_bundle Vehicles ${A} 2>&1 | tee -a unity-build-bundles-Vehicles.log
done
fi

if [ ! -z ${SIM_SENSORS+x} ]; then
getAssets "${SIM_SENSORS}"
for A in ${ASSETS}; do
BUNDLE=$(expr ${BUNDLE} + 1)
build_bundle Sensors ${A} 2>&1 | tee -a unity-build-bundles-Sensors.log
done
fi

if [ ! -z ${SIM_BRIDGES+x} ]; then
getAssets "${SIM_BRIDGES}"
for A in ${ASSETS}; do
BUNDLE=$(expr ${BUNDLE} + 1)
build_bundle Bridges ${A} 2>&1 | tee -a unity-build-bundles-Bridges.log
done
fi
Expand Down
2 changes: 1 addition & 1 deletion Jenkins/upload-bundles-wise.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

#set -eu
#set -x
Expand Down
4 changes: 2 additions & 2 deletions Jenkins/upload-bundles.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -eu
set -x
Expand All @@ -18,7 +18,7 @@ function uploadAssets()
echo "$1" | while IFS= read -r LINE ; do
local ID="${LINE%% *}"
local NAME="${LINE#* }"
aws s3 cp ${S3_BUCKET_ACL} "${SOURCE_FOLDER}/${PREFIX}_${NAME}" s3://${S3_BUCKET_NAME}/v2/${ID}/
aws s3 cp ${S3_BUCKET_ACL=} "${SOURCE_FOLDER}/${PREFIX}_${NAME}" s3://${S3_BUCKET_NAME}/v2/${ID}/
done
}

Expand Down

0 comments on commit ce4d54e

Please sign in to comment.