Hi I am trying to integrate gpg keys into my bitbucket pipelines to securely decrypt the files during pipelines runtime
Steps followed:
step1: Created a new gpg key pair on my local
step2: exported both private and public keys
step3: encrypted a sample file using the above key as recipient
step4: Imported the keys in to bitbucket pipelines as below
# Command used to import private key
gpg --batch --import private.key
# Command used to import public key
gpg --batch --import public.key
step5: I am able to successfully add the keys which i am able to confirm using the below command in the BB pipelines
gpg --list-secret-keys
step6: Now using the below command in the BB pipelines I am trying to decrypt the file encrypted in step3 from my local
gpg --batch --yes --passphrase=$GPG_PRIVATE_KEY_PASSPHRASE --output sample.json --decrypt sample.json.gpg
The above step is not throwing any errors but when i try to view the file by using
cat sample.json
in the next step there it is throwing error cat: sample.json: No such file or directory
Note: All the above steps are working as expected on my local even step6 is providing the output as expected.
Please let me know is this the way to use gpg within the BB pipelines or am i missing anything. Thanks.