To fetch the Jenkins Secret from a Jenkins Server to EC2 instance under the specific location

0

Hi AWS,

I have deployed a backend application written in NodeJS on EC2 instance. Post that I have created the CI/CD pipeline for the same using Jenkins pipeline. I don't want to store the .env file on the source control (Bitbucket in my case), rather want to create it on the fly and use them as Jenkins secrets.

However when the pipeline completes and resulted into the SUCCESS state the .env file is not getting stored on the EC2 instance where the repository is cloned. Can you please tell me what's the reason for that.

profile picture
demandé il y a un an209 vues
1 réponse
1
Réponse acceptée

If I interpret correctly, the .env is not part of the source control and so it is not intended to be present on EC2 as part of git clone (unless you mean it to be present there through git clone and have not specified the file under .gitignore). With a gitignore file, all files that start with a period ( . ) will be ignored.

If you are creating a .env file on the fly in a jenkins workspace, you will need to copy the file across to EC2 explicitly by using something like "execute command over SSH" and then using "scp" or through "Publish Over SSH plugin" in Jenkins.

AWS
répondu il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions