Skip to content

Commit

Permalink
add debugging around RPM pub key
Browse files Browse the repository at this point in the history
  • Loading branch information
diegommm committed Oct 18, 2024
1 parent ecd6abd commit c372ef2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gpg/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ func Signer(d *dagger.Client, pubkey, privkey, passphrase string) *dagger.Contai

return d.Container().From("debian:sid").
WithExec([]string{"apt-get", "update"}).
WithExec([]string{"apt-get", "install", "-yq", "rpm", "gnupg2"}).
WithExec([]string{"apt-get", "install", "-yq", "rpm", "gnupg2", "file"}).
WithMountedSecret("/root/.rpmdb/privkeys/grafana.key", gpgPrivateKeySecret).
WithMountedSecret("/root/.rpmdb/pubkeys/grafana.key", gpgPublicKeySecret).
WithMountedSecret("/root/.rpmdb/passkeys/grafana.key", gpgPassphraseSecret).
WithExec([]string{"/bin/sh", "-c", `
echo "DEBUG: Mounted RPM Pub Key file detected to be: $(file "/root/.rpmdb/pubkeys/grafana.key")";
echo "DEBUG: Mounted RPM Pub Key file has $(wc -c "/root/.rpmdb/pubkeys/grafana.key") bytes";
echo "DEBUG: Mounted RPM Pub Key file has $(wc -l "/root/.rpmdb/pubkeys/grafana.key") lines";
if grep -q "PUBLIC KEY" "/root/.rpmdb/pubkeys/grafana.key"; then
cp "/root/.rpmdb/pubkeys/grafana.key" "/tmp/grafana.key";
else
Expand All @@ -44,6 +47,8 @@ func Signer(d *dagger.Client, pubkey, privkey, passphrase string) *dagger.Contai
if [ "$(tail -n 1 "/tmp/grafana.key" | wc -l)" = 0 ]; then
echo >> "/tmp/grafana.key";
fi;
echo "DEBUG: Final RPM Pub Key file has $(wc -c "/tmp/grafana.key") bytes";
echo "DEBUG: Final RPM Pub Key file has $(wc -l "/tmp/grafana.key") lines";
`}).
WithExec([]string{"rpm", "--import", "/tmp/grafana.key"}).
WithNewFile("/root/.rpmmacros", RPMMacros, dagger.ContainerWithNewFileOpts{
Expand Down

0 comments on commit c372ef2

Please sign in to comment.