only decrypt if the key is available (#3858)

* only decrypt if the key is available

* Use script instead of explicit command

* Don't deploy if the keyfile is missing/empty.

* Don't deploy if key is not available.

* Don't decrypt appveyor key if no secret

* wrong name

* Fix the logic and a typo
This commit is contained in:
Joseph Lenox 2017-04-05 11:27:04 -05:00 committed by GitHub
parent 66c7eb72b5
commit 04b59affce
5 changed files with 21 additions and 11 deletions

View File

@ -1,9 +1,6 @@
language: perl
before_install:
- openssl aes-256-cbc -K $encrypted_daaf322d08bf_key -iv $encrypted_daaf322d08bf_iv
-in $TRAVIS_BUILD_DIR/package/deploy/slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa
-d
- chmod 600 ~/slic3r-upload.rsa
- sh package/linux/travis-decrypt-key
install:
- export LDLOADLIBS=-lstdc++
- export BOOST_DIR=$HOME/boost_1_63_0

View File

@ -16,8 +16,8 @@ environment:
secure: fYPwnI3p6HNR+eMRJR3JfmyNolFn+Uc0MUn2bBXp9uU=
install:
- nuget install secure-file -ExcludeVersion
- secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.ppk.enc -secret %ENC_SECRET%
- IF DEFINED ENC_SECRET nuget install secure-file -ExcludeVersion
- IF DEFINED ENC_SECRET secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.ppk.enc -secret %ENC_SECRET%
- ps: "& package/win/appveyor_preinstall.ps1"
cache:
- C:\Users\appveyor\boost.1.63.0.7z

View File

@ -10,7 +10,11 @@ KEY=$1
shift
FILES=$*
for i in $FILES; do
filepath=$(readlink -f "$i")
echo put $filepath | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/"
done
if [ -s $KEY ]; then
for i in $FILES; do
filepath=$(readlink -f "$i")
echo put $filepath | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/"
done
else
echo "$KEY is not available, not deploying."
fi

View File

@ -10,4 +10,6 @@ Param(
)
Set-Variable -Name "UUSER" -Value "$env:UPLOAD_USER"
Set-Variable -Name "UPLOAD" -Value "$($FILE | Resolve-Path)"
winscp.com /privatekey=$KEY /command "open sftp://$UUSER@dl.slic3r.org/$DIR -hostkey=*" "put $UPLOAD ./$FILE" "exit"
if (Test-Path $KEY) {
winscp.com /privatekey=$KEY /command "open sftp://$UUSER@dl.slic3r.org/$DIR -hostkey=*" "put $UPLOAD ./$FILE" "exit"
}

View File

@ -0,0 +1,7 @@
#!/bin/bash
# Script to only decrypt if it is available
if [ ! -z ${encrypted_daaf322d08bf_key+x} ]; then
openssl aes-256-cbc -K $encrypted_daaf322d08bf_key -iv $encrypted_daaf322d08bf_iv -in $TRAVIS_BUILD_DIR/package/deploy/slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa -d
chmod 600 ~/slic3r-upload.rsa
fi