5050docker build -t " ${IMAGE_NAME} -${USER_NAME} " - << UserSpecificDocker
5151FROM --platform=linux/amd64 ${IMAGE_NAME}
5252RUN groupadd --non-unique -g ${GROUP_ID} ${USER_NAME} && \
53- useradd -l -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME}
53+ useradd -l -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME} && \
54+ ([ "$( dirname " $HOME " ) " -eq "/home" ] || ln -s /home $( dirname " $HOME " ) ) && \
55+ mkdir -p /gpg && chown ${USER_ID} :${GROUP_ID} /gpg && chmod 700 /gpg
5456ENV HOME /home/${USER_NAME}
5557UserSpecificDocker
5658
@@ -72,7 +74,13 @@ RC_DIR="bookkeeper-${VERSION}-rc${RC_NUM}"
7274RC_TAG=" v${VERSION} -rc${RC_NUM} "
7375
7476CMD="
75- gpg-agent --daemon --pinentry-program /usr/bin/pinentry --homedir \$ HOME/.gnupg --use-standard-socket
77+ # copy ~/.gnupg to /gpg in the container to workaround issue with permissions
78+ cp -Rdp \$ HOME/.gnupg /gpg
79+ # remove any previous sockets
80+ rm -rf /gpg/.gnupg/S.*
81+ # set GNUPGHOME to /gpg/.gnupg
82+ export GNUPGHOME=/gpg/.gnupg
83+ gpg-agent --daemon --pinentry-program /usr/bin/pinentry --allow-loopback-pinentry --default-cache-ttl 3600
7684echo
7785echo 'Welcome to Apache BookKeeper Release Build Env'
7886echo
@@ -92,9 +100,21 @@ echo 'RC_TAG = $RC_TAG'
92100echo
93101echo 'Before executing any release scripts, PLEASE configure your git to cache your github password:'
94102echo
103+ echo ' // take a backup of ~/.gitconfig, remember to restore it after the release process'
104+ echo ' \$ cp ~/.gitconfig ~/.gitconfig.bak.\$ (date -I)'
105+ echo ' // remove any previous credential helper configuration'
106+ echo ' \$ git config --global -l --name-only | grep credential | uniq | xargs -i{} git config --global --unset-all {}'
107+ echo ' // fix permission warning with git in docker on MacOS'
108+ echo ' \$ git config --global --add safe.directory $PWD '
109+ echo ' \$ git config --global --add safe.directory \$ PWD'
95110echo ' // configure credential helper to cache your github password for 1 hr during the whole release process '
96111echo ' \$ git config --global credential.helper \" cache --timeout=3600\" '
97- echo ' \$ git push apache --dry-run '
112+ echo ' // in another terminal get a GitHub token to be used as a password for the release process, assuming you are using GitHub CLI.'
113+ echo ' \$ gh auth token '
114+ echo ' // attempt to push to apache remote to cache your password'
115+ echo ' \$ git push apache HEAD:test --dry-run '
116+ echo ' // cache gpg password by signing a dummy file'
117+ echo ' \$ echo dummy > /tmp/dummy && gpg -sa /tmp/dummy'
98118echo
99119bash
100120"
0 commit comments