Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for yubikey in debbuild 🦌 #759

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions tekton/debbuild/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ RUN set -ex \
&& sed -i -- 's/# deb-src/deb-src/g' /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
dput \
cdbs \
git \
curl \
equivs \
vim \
libdistro-info-perl \
golang-any \
devscripts \
debhelper \
dh-golang \
fakeroot \
build-essential \
dput \
cdbs \
git \
curl \
equivs \
vim \
libdistro-info-perl \
golang-any \
devscripts \
debhelper \
dh-golang \
fakeroot \
pcscd \
scdaemon \
&& apt-get clean \
&& rm -rf /tmp/* /var/tmp/*

Expand Down
2 changes: 2 additions & 0 deletions tekton/debbuild/container/buildpackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ cd cli-${version}

dch -M -v ${version}-${RELEASE} -D $(sed -n '/DISTRIB_CODENAME/ { s/.*=//;p;;}' /etc/lsb-release) "new update"

pcscd
gpgconf --kill gpg-agent && gpg-agent --pinentry-program /usr/bin/pinentry-curses --verbose --daemon
gpg --card-status || true
debuild -S --force-sign -k${GPG_KEY}

cd ..
Expand Down
26 changes: 18 additions & 8 deletions tekton/debbuild/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@ set -eux
# and have your gpg setup in your profile
PPATARGET=tektoncd/cli
GPG_KEY=${GPG_KEY}
YUBIKEY=${YUBIKEY:-}
ADDITIONAL_ARGS=${ADDITIONAL_ARGS:-}

[[ -n ${GPG_KEY} ]] || {
echo "You need to setup your GPG_KEY"
exit 1
echo "You need to setup your GPG_KEY"
exit 1
}

[[ -n ${YUBIKEY} ]] && {
ADDITIONAL_ARGS="${ADDITIONAL_ARGS} -v /dev/bus/usb:/dev/bus/usb \
-v /sys/bus/usb:/sys/bus/usb \
-v /sys/devices:/sys/devices \
-v ${YUBIKEY}:${YUBIKEY} \
--privileged"
}

gpg --list-secret-keys >/dev/null || { echo "You need to have a secret GPG key"; exit 1 ;}

Expand All @@ -22,9 +31,10 @@ docker build -t ubuntu-build-deb .
cd ..
fpath=$(readlink -f control)
docker run --rm \
-v ~/.gnupg:/root/.gnupg \
-v ${fpath}:/debian --name ubuntu-build-deb \
--env PPATARGET=${PPATARGET} \
--env GPG_KEY=${GPG_KEY} \
-it ubuntu-build-deb \
/run.sh
-v ~/.gnupg:/root/.gnupg \
$ADDITIONAL_ARGS \
-v ${fpath}:/debian --name ubuntu-build-deb \
--env PPATARGET=${PPATARGET} \
--env GPG_KEY=${GPG_KEY} \
-it ubuntu-build-deb \
/run.sh