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



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
feita há um ano256 visualizações
1 Resposta
Resposta aceita

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.

respondido há um ano
profile picture
avaliado há 2 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas