-
Install terraform
-
Install aws cli
-
configure aws cli
-
Create a sonarqube account and create access token.
-
Create a jfrog artifactory account and select maven as a package type and then Generate access key token.
-
Create a github access token in the same github account where your application code is hosted in.
-
You will use these access keys and corresponding passwords/usernames in the jenkins-node.sh file but make sure not to hardcode these credentials into the bash script but use a secrets manager like aws secrets manager to store and manage these secrets.
-
In our case we used AWS Secrets manager configured using terraform
- Clone the repo via SSH or HTTPS
#SSH
git clone [email protected]:thab310/devops-project-1.git
#HTTPS
git clone https://github.com/thab310/devops-project-1.git
- CD into
devops-project-1
and createterraform.tfvars
cd devops-project-1 && touch terraform.tfvars
- Update
terraform.tfvars
profile = ""
region = ""
owner = ""
- Run
terraform init
andterraform apply
- Updated
- login to http//:jenkins__master_ec2_IP:8080
- Enable Webhook
-
Go to multibranch pipeline job job--> configure --> Scan Multibranch Pipeline Triggers --> Scan Multibranch Pipeline Triggers --> Scan by webhook Trigger token: <token_name>
-
Add webhook to Github repository Github repo --> settings --> webhooks --> Add webhook Payload URI: <jenkins_IP>:8080/multibranch-webhook-trigger/invoke?token=<token_name> content type: application/json Which event would you like to trigger this webhook: just the push event
-
Create multi-branch pipeline in jenkins
-
Setup webhook in order to run jenkins pipeline automatically