Signed-off-by: Mike Dougherty <mike.dougherty@docker.com>
| ... | ... |
@@ -15,6 +15,7 @@ set -e |
| 15 | 15 |
# ... and so on and so forth for the builds created by hack/make/build-deb |
| 16 | 16 |
|
| 17 | 17 |
: ${DOCKER_RELEASE_DIR:=$DEST}
|
| 18 |
+: ${GPG_KEYID:=releasedocker}
|
|
| 18 | 19 |
APTDIR=$DOCKER_RELEASE_DIR/apt/repo |
| 19 | 20 |
|
| 20 | 21 |
# setup the apt repo (if it does not exist) |
| ... | ... |
@@ -63,7 +64,7 @@ for dir in contrib/builder/deb/*/; do |
| 63 | 63 |
# dpkg-sign before reprepro |
| 64 | 64 |
if [ ! -z "$GPG_PASSPHRASE" ]; then |
| 65 | 65 |
dpkg-sig -g "--passphrase $GPG_PASSPHRASE" \ |
| 66 |
- -k releasedocker --sign builder "${DEBFILE[@]}"
|
|
| 66 |
+ -k "$GPG_KEYID" --sign builder "${DEBFILE[@]}"
|
|
| 67 | 67 |
fi |
| 68 | 68 |
|
| 69 | 69 |
reprepro -v $options \ |
| ... | ... |
@@ -16,6 +16,7 @@ set -e |
| 16 | 16 |
|
| 17 | 17 |
: ${DOCKER_RELEASE_DIR:=$DEST}
|
| 18 | 18 |
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo |
| 19 |
+: ${GPG_KEYID:=releasedocker}
|
|
| 19 | 20 |
|
| 20 | 21 |
# manage the repos for each distribution separately |
| 21 | 22 |
distros=( fedora centos oraclelinux ) |
| ... | ... |
@@ -53,15 +54,15 @@ for distro in "${distros[@]}"; do
|
| 53 | 53 |
# sign the rpms before adding to repo |
| 54 | 54 |
if [ ! -z $GPG_PASSPHRASE ]; then |
| 55 | 55 |
# export our key to rpm import |
| 56 |
- gpg --armor --export releasedocker > /tmp/gpg |
|
| 56 |
+ gpg --armor --export "$GPG_KEYID" > /tmp/gpg |
|
| 57 | 57 |
rpm --import /tmp/gpg |
| 58 | 58 |
|
| 59 | 59 |
# sign the rpms |
| 60 | 60 |
echo "yes" | setsid rpm \ |
| 61 |
- --define '_gpg_name releasedocker' \ |
|
| 62 |
- --define '_signature gpg' \ |
|
| 63 |
- --define '__gpg_check_password_cmd /bin/true' \ |
|
| 64 |
- --define '__gpg_sign_cmd %{__gpg} gpg --batch --no-armor --passphrase '$GPG_PASSPHRASE' --no-secmem-warning -u "%{_gpg_name}" --sign --detach-sign --output %{__signature_filename} %{__plaintext_filename}' \
|
|
| 61 |
+ --define "_gpg_name $GPG_KEYID" \ |
|
| 62 |
+ --define "_signature gpg" \ |
|
| 63 |
+ --define "__gpg_check_password_cmd /bin/true" \ |
|
| 64 |
+ --define "__gpg_sign_cmd %{__gpg} gpg --batch --no-armor --passphrase '$GPG_PASSPHRASE' --no-secmem-warning -u '%{_gpg_name}' --sign --detach-sign --output %{__signature_filename} %{__plaintext_filename}" \
|
|
| 65 | 65 |
--resign "${RPMFILE[@]}"
|
| 66 | 66 |
fi |
| 67 | 67 |
|
| ... | ... |
@@ -4,6 +4,7 @@ |
| 4 | 4 |
# with a designated GPG key. |
| 5 | 5 |
|
| 6 | 6 |
: ${DOCKER_RELEASE_DIR:=$DEST}
|
| 7 |
+: ${GPG_KEYID:=releasedocker}
|
|
| 7 | 8 |
APTDIR=$DOCKER_RELEASE_DIR/apt/repo |
| 8 | 9 |
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo |
| 9 | 10 |
|
| ... | ... |
@@ -21,12 +22,12 @@ sign_packages(){
|
| 21 | 21 |
# sign apt repo metadata |
| 22 | 22 |
if [ -d $APTDIR ]; then |
| 23 | 23 |
# create file with public key |
| 24 |
- gpg --armor --export releasedocker > "$DOCKER_RELEASE_DIR/apt/gpg" |
|
| 24 |
+ gpg --armor --export "$GPG_KEYID" > "$DOCKER_RELEASE_DIR/apt/gpg" |
|
| 25 | 25 |
|
| 26 | 26 |
# sign the repo metadata |
| 27 | 27 |
for F in $(find $APTDIR -name Release); do |
| 28 | 28 |
if test "$F" -nt "$F.gpg" ; then |
| 29 |
- gpg -u releasedocker --passphrase "$GPG_PASSPHRASE" \ |
|
| 29 |
+ gpg -u "$GPG_KEYID" --passphrase "$GPG_PASSPHRASE" \ |
|
| 30 | 30 |
--armor --sign --detach-sign \ |
| 31 | 31 |
--batch --yes \ |
| 32 | 32 |
--output "$F.gpg" "$F" |
| ... | ... |
@@ -37,12 +38,12 @@ sign_packages(){
|
| 37 | 37 |
# sign yum repo metadata |
| 38 | 38 |
if [ -d $YUMDIR ]; then |
| 39 | 39 |
# create file with public key |
| 40 |
- gpg --armor --export releasedocker > "$DOCKER_RELEASE_DIR/yum/gpg" |
|
| 40 |
+ gpg --armor --export "$GPG_KEYID" > "$DOCKER_RELEASE_DIR/yum/gpg" |
|
| 41 | 41 |
|
| 42 | 42 |
# sign the repo metadata |
| 43 | 43 |
for F in $(find $YUMDIR -name repomd.xml); do |
| 44 | 44 |
if test "$F" -nt "$F.asc" ; then |
| 45 |
- gpg -u releasedocker --passphrase "$GPG_PASSPHRASE" \ |
|
| 45 |
+ gpg -u "$GPG_KEYID" --passphrase "$GPG_PASSPHRASE" \ |
|
| 46 | 46 |
--armor --sign --detach-sign \ |
| 47 | 47 |
--batch --yes \ |
| 48 | 48 |
--output "$F.asc" "$F" |
| ... | ... |
@@ -22,8 +22,9 @@ To run, I need: |
| 22 | 22 |
environment variables AWS_S3_BUCKET and AWS_S3_BUCKET_PATH (default: ''); |
| 23 | 23 |
- to be provided with AWS credentials for this S3 bucket, in environment |
| 24 | 24 |
variables AWS_ACCESS_KEY and AWS_SECRET_KEY; |
| 25 |
-- the passphrase to unlock the GPG key which will sign the deb packages |
|
| 26 |
- (passed as environment variable GPG_PASSPHRASE); |
|
| 25 |
+- the passphrase to unlock the GPG key specified by the optional environment |
|
| 26 |
+ variable GPG_KEYID (default: releasedocker) which will sign the deb |
|
| 27 |
+ packages (passed as environment variable GPG_PASSPHRASE); |
|
| 27 | 28 |
- a generous amount of good will and nice manners. |
| 28 | 29 |
The canonical way to run me is to run the image produced by the Dockerfile: e.g.:" |
| 29 | 30 |
|
| ... | ... |
@@ -265,7 +266,7 @@ release_ubuntu() {
|
| 265 | 265 |
local debfiles=( "bundles/$VERSION/ubuntu/"*.deb ) |
| 266 | 266 |
|
| 267 | 267 |
# Sign our packages |
| 268 |
- dpkg-sig -g "--passphrase $GPG_PASSPHRASE" -k releasedocker --sign builder "${debfiles[@]}"
|
|
| 268 |
+ dpkg-sig -g "--passphrase $GPG_PASSPHRASE" -k "$GPG_KEYID" --sign builder "${debfiles[@]}"
|
|
| 269 | 269 |
|
| 270 | 270 |
# Setup the APT repo |
| 271 | 271 |
APTDIR=bundles/$VERSION/ubuntu/apt |
| ... | ... |
@@ -282,14 +283,14 @@ EOF |
| 282 | 282 |
|
| 283 | 283 |
# Sign |
| 284 | 284 |
for F in $(find $APTDIR -name Release); do |
| 285 |
- gpg -u releasedocker --passphrase "$GPG_PASSPHRASE" \ |
|
| 285 |
+ gpg -u "$GPG_KEYID" --passphrase "$GPG_PASSPHRASE" \ |
|
| 286 | 286 |
--armor --sign --detach-sign \ |
| 287 | 287 |
--output "$F.gpg" "$F" |
| 288 | 288 |
done |
| 289 | 289 |
|
| 290 | 290 |
# Upload keys |
| 291 | 291 |
s3cmd sync "$HOME/.gnupg/" "s3://$BUCKET/ubuntu/.gnupg/" |
| 292 |
- gpg --armor --export releasedocker > "bundles/$VERSION/ubuntu/gpg" |
|
| 292 |
+ gpg --armor --export "$GPG_KEYID" > "bundles/$VERSION/ubuntu/gpg" |
|
| 293 | 293 |
s3cmd --acl-public put "bundles/$VERSION/ubuntu/gpg" "s3://$BUCKET/gpg" |
| 294 | 294 |
|
| 295 | 295 |
local gpgFingerprint=36A1D7869245C8950F966E92D8576A8BA88D21E9 |
| ... | ... |
@@ -365,14 +366,14 @@ setup_gpg() {
|
| 365 | 365 |
# Make sure that we have our keys |
| 366 | 366 |
mkdir -p "$HOME/.gnupg/" |
| 367 | 367 |
s3cmd sync "s3://$BUCKET/ubuntu/.gnupg/" "$HOME/.gnupg/" || true |
| 368 |
- gpg --list-keys releasedocker >/dev/null || {
|
|
| 368 |
+ gpg --list-keys "$GPG_KEYID" >/dev/null || {
|
|
| 369 | 369 |
gpg --gen-key --batch <<EOF |
| 370 | 370 |
Key-Type: RSA |
| 371 | 371 |
Key-Length: 4096 |
| 372 | 372 |
Passphrase: $GPG_PASSPHRASE |
| 373 | 373 |
Name-Real: Docker Release Tool |
| 374 | 374 |
Name-Email: docker@docker.com |
| 375 |
-Name-Comment: releasedocker |
|
| 375 |
+Name-Comment: $GPG_KEYID |
|
| 376 | 376 |
Expire-Date: 0 |
| 377 | 377 |
%commit |
| 378 | 378 |
EOF |