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
已提問 1 年前檢視次數 209 次
1 個回答
1
已接受的答案

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
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南