If you are planning to use this repo for reference, please hit the star. Thanks!
We plan to utilize GitHub Actions and Terraform to deploy our React project on AWS EKS.
We will deploy React Application on aws Elastic Kubernetes(EKS). We will use Github actions for the ci/cd pipeline. We will use EC2 as the self-hosted runner for our GitHub Actions. We will integrate Sonarcube for code analysis and Trivt Image scan to scan our docker images. Also, we will integrate slack to get Build/deployment notifications.
Youtube Video Tutorial: https://www.youtube.com/live/HkGMxxjBt8g?si=PzSJEGwPrJmn8yli
You should have basic Knowledge of AWS services, Docker, Kubernetes, and GitHub Actions.
1. Create an AWS EC2 Instance and an IAM Role
2. Add a Self Hosted Runner To AWS EC2
3. Docker Installation and Running SonarQube Container
4. Integrate SonarQube with GitHub Actions
5. Installation of tools (Java JDK, Terraform, Trivy, Kubectl, Node.js, NPM, AWS CLI)
6. Provision AWS EKS With Terraform
7. Dockerhub and Trivy Image Scan Setup
8. Deploy Application(image) to AWS EKS
9. Integrate Slack Notifications
10. Running Final/Complete Github actions Workflow
11. Delete the infrastructure (To Avoid Extra Billing, if you are just using it for learning Purposes)
You have to Navigate to AWS Console.
![Screenshot 2024-01-10 at 1 46 32 PM](https://private-user-images.githubusercontent.com/51082957/295662437-dde7560a-7366-4dc4-8628-21e6c27fa4f2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjI0MzctZGRlNzU2MGEtNzM2Ni00ZGM0LTg2MjgtMjFlNmMyN2ZhNGYyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTExMmI4NzRmZDMyOWRkOTI1Y2Y4NmIxOGVkN2M3NGU1ZGE5NWRhZGNmZjkwYzBkMzRlNWFlZGVjOWEzMzkxOTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.GbxHnJqKeAxZalIsy3zEae9ovcQ_JG6k3xDQk6Sq0BE)
Then Search/Enter IAM
![Screenshot 2024-01-10 at 1 48 17 PM](https://private-user-images.githubusercontent.com/51082957/295662475-d1763507-622a-4e22-a4ea-00cab115ecf5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjI0NzUtZDE3NjM1MDctNjIyYS00ZTIyLWE0ZWEtMDBjYWIxMTVlY2Y1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ0ZmUyYTEzNjM1OTVmY2U4MTA2NjNjZTdhMzhmM2YyNGEzZWIxNDE0YTFmNWViNGQ5OWVhZGMwZjI1YWY3NjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.5b4zgHuoecLi6O9z6ohAjTbVJ5sFEGmf6KQL2t-xUus)
Click Roles
![Screenshot 2024-01-10 at 1 50 14 PM](https://private-user-images.githubusercontent.com/51082957/295662543-542841cc-5f05-41d8-892f-dba00056890a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjI1NDMtNTQyODQxY2MtNWYwNS00MWQ4LTg5MmYtZGJhMDAwNTY4OTBhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI3NDQ1MTY1Y2UzNDQ4MjBmMWFhZTA4OGFjOTJhNWFjZGQxMWQ2OTI1NjZkYTU4YWYyNGRiOTVlNGNlZmJiMjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zm-iguLqtvdLbQG-MxsAeQo9WY04nCxTS9JwJpS_kuE)
Then Click Create role
![Screenshot 2024-01-10 at 1 56 03 PM](https://private-user-images.githubusercontent.com/51082957/295662696-38016a29-8358-499b-8783-6febdc82e16f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjI2OTYtMzgwMTZhMjktODM1OC00OTliLTg3ODMtNmZlYmRjODJlMTZmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMyOGEwZDI5Zjk1MGUxMTc3YTg3MmI2YWUyZDlmZDgwYzAwMzY0ODBjYTAzODFjYmZmNDhjZDNiODg0MjY5YmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Pph_DHRKSs1YOR6NidlMe2j7tJHggwqPLdbN10L0Hsc)
Now Click AWS Service, And Then Click Choose a service or use case
![Screenshot 2024-01-10 at 1 57 20 PM](https://private-user-images.githubusercontent.com/51082957/295662768-7a49baaf-9df0-4f74-a10a-e1abcea86885.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjI3NjgtN2E0OWJhYWYtOWRmMC00Zjc0LWExMGEtZTFhYmNlYTg2ODg1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU3ZDU1YTk5MDgxZjcxMGU1ZTc1YmVmMWNhMjQ0ZGYwOTcwNTlkM2VlMTUwYTQ0YmU1Y2NjYWM4ZGZhZmJjZTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.QMnTJuacby_DpjN-3fPnDoFMur0LdbAF6_E_oWCFkJw)
Now Click EC2 and Click NEXT
![Screenshot 2024-01-10 at 1 58 03 PM](https://private-user-images.githubusercontent.com/51082957/295662824-a2a59d66-135c-45fc-bed7-a62db0246be5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjI4MjQtYTJhNTlkNjYtMTM1Yy00NWZjLWJlZDctYTYyZGIwMjQ2YmU1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVhZTNlMDgxOTE4OTIyNTA4MzNjZjBhMWRjNTc3YmZhMzg0ZGZkYzgxY2RlYmRhYTFlMGM0ZmY2MjNhYTdkZjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rlnCNqq8khkv4jyoIhWA17zrlXhAW0hJVkbiUCX75II)
Click the Search Fileds, Then Add permissions Policies
![Screenshot 2024-01-10 at 2 16 39 PM](https://private-user-images.githubusercontent.com/51082957/295662902-1a761f3d-1529-49b5-a911-672dd51885cc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjI5MDItMWE3NjFmM2QtMTUyOS00OWI1LWE5MTEtNjcyZGQ1MTg4NWNjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUwMjdiYzAzNjNmMjA2Yjg1YTZhNmI0NTYzMmZjMWJlZTFjMjFjYmVhZWQzMTkzYjYzNGRiYzdmMmQ0ZmExNGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.52UMqxmuSihWqlHqQAr8MRCyhKeYQDHUK3qZC6g5H-0)
Add These Four Policies:
- EC2 full access
- AmazonS3FullAccess
- AmazonEKSClusterPolicy
- AdministratorAccess
![Screenshot 2024-01-11 at 6 55 41 PM](https://private-user-images.githubusercontent.com/51082957/295937284-ec891586-603a-4764-ad91-367f77c4b072.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzcyODQtZWM4OTE1ODYtNjAzYS00NzY0LWFkOTEtMzY3Zjc3YzRiMDcyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJkMmMwZGM1NTkxZDMwYzYyYmQ1OWRmNzZlZjMxN2MzODI1ZjEyZWMzYTg0MjhjZDZmOTIxY2ZjNjY3ZGE4YTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.8VxXMo5F9pYm7_E3bxtbNfLneJAuDsKaJmF4j2I3oQo)
Click NEXT and Then click the Role Name Field.
Type cicd-jenkins
Click Create role
![Screenshot 2024-01-10 at 2 07 55 PM](https://private-user-images.githubusercontent.com/51082957/295663352-eceb084b-ebf7-448c-9dcb-422412d3ea2b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjMzNTItZWNlYjA4NGItZWJmNy00NDhjLTlkY2ItNDIyNDEyZDNlYTJiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY2NDk4NDIwYTMzN2FhMDhhYzdmZGU1NjBlNzM1MjVmMGQwNTQ0MTBjMzBmYzYyNWVhZmMwMzkzY2YzMmY1MDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.cajsa9WSJjeFLcIrRDg30CuYgVGbYxp4orM3Z-n8L9Y)
Note We will use/attach this AIM Role during AWS EC2 instance Creation.
To launch an AWS EC2 instance running Ubuntu 22.04 via the AWS Management Console, start by signing in to your AWS account and accessing the EC2 dashboard. Click on "Launch Instances" and proceed through the steps. In "Step 1," select "Ubuntu 22.04" as the AMI, and in "Step 2," opt for "t2.medium" as the instance type. Configure instance details, storage, tags, and security group settings according to your requirements. Additionally, attach the previously created IAM role in the advanced details. Review the settings, create or select a key pair for secure access, and then launch the instance. Once launched, utilize the associated key pair to connect via SSH for access, ensuring the security of your connection. (Look at image Below)
![Screenshot 2024-01-10 at 5 40 06 PM](https://private-user-images.githubusercontent.com/51082957/295663587-82726782-2ba8-4913-a14d-3cf4cafdcc33.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjM1ODctODI3MjY3ODItMmJhOC00OTEzLWExNGQtM2NmNGNhZmRjYzMzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE5OTQzYThlZDUwMjJjMzg1YThiZjljYWFmZTg3ZGUyNDgzNGY2YmU1N2MzYjZiODNhM2Q3YmUwODkzN2Q2NzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.4z_dRXZpRn6nUF0KA6PWdS1rayaXgyyDYoWDRrR91uE)
![Screenshot 2024-01-10 at 5 40 25 PM](https://private-user-images.githubusercontent.com/51082957/295663601-a6bac162-eb7a-4f3e-b845-0e1adce8a690.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjM2MDEtYTZiYWMxNjItZWI3YS00ZjNlLWI4NDUtMGUxYWRjZThhNjkwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM1YmQ2YjFhNTgxZjBlNDc4ZTk2NzkyNjA4MWRiODI4MTlhN2IzOTAwNjdlMTY0NDkxZDA3MTczMjNhNzkxOWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.pa9OWi0bhXOI4c6bU6OWpzKEUCzDtiOsd3PWj01v16k)
Now Go to GitHub Repository and click on Settings -> Actions -> Runners
Click on New self-hosted runner
![Screenshot 2024-01-10 at 1 35 16 PM](https://private-user-images.githubusercontent.com/51082957/295663821-0e79f558-b4b2-4a24-8251-7e209e728681.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjM4MjEtMGU3OWY1NTgtYjRiMi00YTI0LTgyNTEtN2UyMDllNzI4NjgxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcxZWVhNDg4YzViMTVlOWM1MGNhNTE0MDBkMjkyOTcxNzFjMWUzMjU4MTMyNmJiMDRhZjM3OGVkMTZiYmQxZWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.6bBPylOGAwdkFGPX_Jbi5Aw6GYnjTeirv2b0d8X6AV0)
![Screenshot 2024-01-10 at 5 50 48 PM](https://private-user-images.githubusercontent.com/51082957/295663701-2b8f00f7-9a32-468a-b57a-6ff024dc8984.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjM3MDEtMmI4ZjAwZjctOWEzMi00NjhhLWI1N2EtNmZmMDI0ZGM4OTg0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1OWU1ZmI0OGI2MWE5ODJhOGRjOTI0Y2JlMTBkYTYyMjU1Y2E4N2I2Y2NjOTVkYzY3N2E0MTRmYmQwNTUxMDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.OpAEk9ZcYmaQk3ecfDp8oaNl5EWCg9kPesjvkhTQ21Q)
Now select Linux and Architecture X64
![Screenshot 2024-01-10 at 5 54 09 PM](https://private-user-images.githubusercontent.com/51082957/295664062-508da348-e371-48e1-be9d-b6d042970470.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjQwNjItNTA4ZGEzNDgtZTM3MS00OGUxLWJlOWQtYjZkMDQyOTcwNDcwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc2ZGU4MTE1OTZhOWYwNjE2OWQ0OWQzMzljM2MwMzBmNzBlZThlYjU3ZTZkMzZiNGIyZWQyZGY2YjVlNjUxZmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.y_iESe2y0KxaNGai8dpIKkYm4SiVYg_x58qhDvKLLMU)
Use the below commands to add a self-hosted runner
Note: In pic Commads are related to my account, Use your commands, it appears on your GitHub self-hosted runner Page.
![Screenshot 2024-01-10 at 5 55 47 PM](https://private-user-images.githubusercontent.com/51082957/295664140-3a142431-ec5e-4bff-8924-2ae7900deb11.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjQxNDAtM2ExNDI0MzEtZWM1ZS00YmZmLTg5MjQtMmFlNzkwMGRlYjExLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQyOGE0OWE0ZTU2YTc1NTliMmYzZDI5MjViMzY3N2I4ZGEzMTgyZmNlZDI2OTI5NWY2YTUwNTQxMDEzMmVhMTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.-5Ti0Ilc4dXWpwCYOj0AQkh0ygGj4flXqYXdSJjQP1M)
Now SSH to your AWS instance to connect with your Instance.
And Past/Run these commands.
mkdir actions-runner && cd actions-runner
![Screenshot 2024-01-10 at 6 02 16 PM](https://private-user-images.githubusercontent.com/51082957/295664250-ac459382-abc1-447b-a1aa-b54ac164db5e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjQyNTAtYWM0NTkzODItYWJjMS00NDdiLWExYWEtYjU0YWMxNjRkYjVlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkyYWIzZTQ2ZDkxN2U4NTY3NjYwYzdlNjM5NTI1ZTc0MDU3ZTdlMzFhZDRjMmQzNTE4ZGZkOGI4ZGIyNGM4MDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.u0G67ghZ85QD4_921rzENbsce0fRu3CWwborBSw-mFs)
Command "mkdir actions-runner && cd actions-runner" serves to generate a fresh directory named "actions-runner" within the present working directory. Subsequently, it swiftly switches the current working directory to this newly created "actions-runner" directory. This approach streamlines file organization and facilitates executing successive actions within the newly formed directory without the need for separate navigation.
Download the latest runner package
curl -o actions-runner-linux-x64-2.311.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.311.0/actions-runner-linux-x64-2.311.0.tar.gz
![Screenshot 2024-01-10 at 6 07 25 PM](https://private-user-images.githubusercontent.com/51082957/295664581-4629710b-6bdf-4012-b9c3-8899cf8a9e51.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjQ1ODEtNDYyOTcxMGItNmJkZi00MDEyLWI5YzMtODg5OWNmOGE5ZTUxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTljYWY5NjBhZDcxOGVhYTFmNjhiOTMyZDlmOGFkMmEwOWVmMTJhM2QyMDJiMTFiNzMwZTI4M2EyYjkxZmI2NjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.jryUr3ipurbMMtYuEcgfm5TIErFT5WMh_JbGoUOICtk)
Validate the hash.
echo "29fc8cf2dab4c195bb147384e7e2c94cfd4d4022c793b346a6175435265aa278 actions-runner-linux-x64-2.311.0.tar.gz" | shasum -a 256 -c
![Screenshot 2024-01-10 at 6 10 55 PM](https://private-user-images.githubusercontent.com/51082957/295664670-fa9890c6-3b20-48fe-9275-2b2a94964219.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjQ2NzAtZmE5ODkwYzYtM2IyMC00OGZlLTkyNzUtMmIyYTk0OTY0MjE5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEwZmVjZDgzMjg2ZGNkOTNjZGJiZDM3MzZlNWI0NzY5YzUwZjY4MDMxMGZmMTk4MzAzZGEzMTAyMDQ5NDg2ZDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.h2i3_BatOP4SfpC5KFaKV73jZc1OicaaKj8XGe7lXgQ)
Now Extract the installer
tar xzf ./actions-runner-linux-x64-2.311.0.tar.gz
Create the runner and start the configuration experience
./config.sh --url https://github.com/codewithmuh/react-aws-eks-github-actions --token AMFXNTP3IVE6IAZSWO3ZEGDFT2QV6
![Screenshot 2024-01-10 at 6 16 09 PM](https://private-user-images.githubusercontent.com/51082957/295664762-e46f9064-2b21-4179-b9af-06406b1d0f1b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjQ3NjItZTQ2ZjkwNjQtMmIyMS00MTc5LWI5YWYtMDY0MDZiMWQwZjFiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk3MTRiZTcxY2I4ODEwOWExZTk4ZDMwMzc5MWVkMjFmODFlZTJhZDEzM2VhMDk5M2M0MzRiY2VlYjkwMGY0Y2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.H_lW9UtrJry325HcLhqTDl0yAEh5BWMWAuOfWFc2PN4)
If you have provide multiple labels use commas for each label.
The last step, run it!
./run.sh
![Screenshot 2024-01-10 at 6 17 33 PM](https://private-user-images.githubusercontent.com/51082957/295664797-c522bc91-d861-4349-84cf-3500788dbae4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjQ3OTctYzUyMmJjOTEtZDg2MS00MzQ5LTg0Y2YtMzUwMDc4OGRiYWU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM3MzJjYzQyMThkZDQxYTM0M2E5MjQyNDgwMjFiZWM5NzI4YTVmMDJkMmI1YzE1YjZlYTA1MGQyYjg2Y2M2ZTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.A3BXmyxSfA98dv_m-1IQSEts281fraI6l2BEKD8LQeY)
Let's close Runner for now.
ctrl + c # To close Run this Command.
Connect with your Instance using SSH or Putty.(The Method you are using). If already connected, ignore.
Run these commands
sudo apt-get update
sudo apt install docker.io -y
sudo usermod -aG docker ubuntu
newgrp docker
sudo chmod 777 /var/run/docker.sock
Now We will Pull SonarQube Docker Image and run the SonarQube Container.
Note Make sure to add a port in the security group of your instance.
docker run -d --name sonar -p 9000:9000 sonarqube:lts-community
![Screenshot 2024-01-10 at 6 31 19 PM](https://private-user-images.githubusercontent.com/51082957/295664857-6b8e9af9-369c-4d19-b1ac-0fdd9d24e136.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjQ4NTctNmI4ZTlhZjktMzY5Yy00ZDE5LWIxYWMtMGZkZDlkMjRlMTM2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMxZjE0MmE4MDAyYjM5OTg1YzliOThhNDBkMGI5OTRlZjk1MTMzOWNjNDdlNzkwMjdiNTM0YTgzM2M3ODlhY2MmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.VjKc-VFzcdZ_UMJEBAfkVEnGK5AAKhfQW8gndmDGzto)
![Screenshot 2024-01-10 at 6 32 50 PM](https://private-user-images.githubusercontent.com/51082957/295664919-710edbed-5093-4411-97e2-2a365b8eade5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjQ5MTktNzEwZWRiZWQtNTA5My00NDExLTk3ZTItMmEzNjViOGVhZGU1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNmZDNiNzhhOTMxZjMzMTgzOTViZTcxOTgxNzcxMDI1Y2ZkYjBiNzg0YTYyZjRhNTU4ZjU1ZmE0NDg2NGZlMTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.y205ya0S1imIUQHSH1OwFQul2k0BjiXZcY6DM0ZYW3A)
Now copy the IP address of Your EC2 instance
<EC2-PUBLIC-IP:9000>
![Screenshot 2024-01-10 at 6 36 04 PM](https://private-user-images.githubusercontent.com/51082957/295664985-57782074-5a76-42e5-81bf-a34d7e4189a2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjQ5ODUtNTc3ODIwNzQtNWE3Ni00MmU1LTgxYmYtYTM0ZDdlNDE4OWEyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTczMWY2YTcwNzI4NTUzMDI2ZTZkNWVhZmFlODIzMjNkOWU2OTYwMDUzYTYxNWY2YmYzYmNhY2Q5YjQ0YTUyOGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.J451uVHqIm66TT6AJjQSb3MFMPIJgFyGAXcDdXyiJcM)
Now Login with these creds.
login admin
password admin
Now Update your Sonarqube password.
![Screenshot 2024-01-10 at 6 38 58 PM](https://private-user-images.githubusercontent.com/51082957/295665172-c2638f04-5df8-489c-8746-ebf65fa874fa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjUxNzItYzI2MzhmMDQtNWRmOC00ODljLTg3NDYtZWJmNjVmYTg3NGZhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNlOGRjYjM3NmVhODc3OTY0NjFlZGQ3YzJmZDYyMWNmMjUzNzI2Njg5MDI5NDUxOGQ3YjcwNjQ1NzljMjU0MmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.WFnwH26VZF9YlvdQb8oEzpp4bQli5VUufT5gmDwAH24)
This is the Sonarqube dashboard.
![Screenshot 2024-01-10 at 6 40 16 PM](https://private-user-images.githubusercontent.com/51082957/295665046-e0dcf4a0-2697-4829-aab1-fbd8ffdd17a5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjUwNDYtZTBkY2Y0YTAtMjY5Ny00ODI5LWFhYjEtZmJkOGZmZGQxN2E1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc1ZTBjNjFlNTc5Y2YzZjkxN2VlNjkzNzM2MzNlNTY2Mjg1OTk0YWRlYzc2NjQwY2ZhNjlkNjY4ZjUwNTc1ZjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.7guPGfvzslq44HQ7DleOZlwewTPHCKBsUdJIC0bPtLU)
Integrating SonarQube with GitHub Actions allows you to automatically analyze your code for quality and security as part of your continuous integration pipeline.We already have Sonarqube up and running
Now On Sonarqube Dashboard click on Manually
![Screenshot 2024-01-10 at 6 42 53 PM](https://private-user-images.githubusercontent.com/51082957/295665328-6a836594-a32d-430c-8ac5-1fd07a406fa8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjUzMjgtNmE4MzY1OTQtYTMyZC00MzBjLThhYzUtMWZkMDdhNDA2ZmE4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUyNzU2NjAyNWRkOTIxMzk2ZTBmYWIzZjI4ZGNlMTMwZjY2ZWJkZWU5NDg4OTgyNDRkN2E4ZGVlMmZmYjM1YWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Cuzl2Auej8iOCsBgkaaI-73tw7UUnU_Y8iizmpmWyjA)
On the Next Page, You have to provide the name of your project and provide a branch name. The Click on SetUp Button.
![Screenshot 2024-01-10 at 6 44 58 PM](https://private-user-images.githubusercontent.com/51082957/295665462-2f705b5c-5ba1-48d9-b1fd-47d6b7e9dcd5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjU0NjItMmY3MDViNWMtNWJhMS00OGQ5LWIxZmQtNDdkNmI3ZTlkY2Q1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTViNWFhZWU2MTVmOGQzNmFhNWZlOTVkNzA1MTRhNGI5YmU1ZmRmYjA5NmY0MmRjODQ0NTdhMTkwYzgwZWE3NzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.k8fKXcPA6Hfp5rMUZXkDovBL2Wlw69JQicHu9Ju8Av0)
On the Next Page, You have to click on "With GitHub Actions"
![Screenshot 2024-01-10 at 6 47 12 PM](https://private-user-images.githubusercontent.com/51082957/295665570-2e4308d9-c4fe-4087-850b-0ca36a261331.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjU1NzAtMmU0MzA4ZDktYzRmZS00MDg3LTg1MGItMGNhMzZhMjYxMzMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJmYjU1ZDY3MzAzNDQwMjBhNWQxYmVkNDVlNDhmMTk0YTZhZDBlZjY2NTAzYzU3OGIzOGYxZTBkYWI0NjEyN2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.4xAQPH_17gZ7pqtPbvRSL9OAdS_xb5eUiEcOfRwFlVM)
This will provide an overview of the project and provide some instructions to integrate.
![Screenshot 2024-01-10 at 6 49 02 PM](https://private-user-images.githubusercontent.com/51082957/295665692-9f36e302-13da-4305-acff-f6425a529040.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjU2OTItOWYzNmUzMDItMTNkYS00MzA1LWFjZmYtZjY0MjVhNTI5MDQwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU5MWQ0YjZlZWU0N2M0YTA5YjRmOGQ2OGJlOTVmYmFjOGVhZGJlYzYzNTJkMWJmZjUyZDE4MjA5Zjk0ODg0MjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Kt06pGZnDppFXaLePF6EgR8e-39Tx6KtI6mW0Den1ms)
Now Let's open your Giuthub Repository.
Now Click on Settings. (if you are using my repo, make sure you have forked it)
![Screenshot 2024-01-10 at 7 34 09 PM](https://private-user-images.githubusercontent.com/51082957/295665779-6918bada-4af9-4ef3-8aa1-acfcdc427365.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjU3NzktNjkxOGJhZGEtNGFmOS00ZWYzLThhYTEtYWNmY2RjNDI3MzY1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA1OTI3ZGE3NjE2MDNkMzFmMTRmMWZjNGQ1M2RkMTU0ZDNhYmViODMxNTE0YzQ3M2ZmZDBjY2Y5NDNhNmQwYmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.XpS9GonJhDGtMk3h_ckK8BrZyHRVCf6TA4fCAqrIQmw)
Click on Secrets and variables and then click on actions.
![Screenshot 2024-01-10 at 7 40 03 PM](https://private-user-images.githubusercontent.com/51082957/295665980-ce27fcd5-0058-4e07-b4d4-f7de73b2413e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjU5ODAtY2UyN2ZjZDUtMDA1OC00ZTA3LWI0ZDQtZjdkZTczYjI0MTNlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNiZGJjODMwZGE2MDU1NmI0NWQxNDljN2RkYjkxNDQ3Y2U4NWM1ZWYyYmRjYmRkMTM0ZjJkMjgxZTM1ZjYwNmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Egb9egaY8DkJU9m1gMOLk7adcOzpR1sMwOmOH8oU70c)
It will open a page, Clock on New Repository secret.
![Screenshot 2024-01-10 at 7 41 05 PM](https://private-user-images.githubusercontent.com/51082957/295666076-73e15994-2ef0-4bb3-90ff-c389bb1868d1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjYwNzYtNzNlMTU5OTQtMmVmMC00YmIzLTkwZmYtYzM4OWJiMTg2OGQxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ0ZThlMjFmOGUxMDRiYzczOWZkMDdjMDIyNDBhZjlmOGM3NDExYzIyMDI5NzhlNWFjZjljNTA5NTc0MDQzODMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.87lkhJAF3Tgi6TW9FAvqoXQ04U9NtLc4oL3UWCUCLrM)
Now Go to your Sonarqube dashboard
Copy SONAR_TOKEN and click on Generate Token
![Screenshot 2024-01-10 at 8 00 42 PM](https://private-user-images.githubusercontent.com/51082957/295666154-2afb8ebf-96e1-4446-997a-5bf0dbc2da80.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjYxNTQtMmFmYjhlYmYtOTZlMS00NDQ2LTk5N2EtNWJmMGRiYzJkYTgwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY5OGRjYjJmYjNkMDIzYmJlZWQ3N2Q2M2EzY2ZkM2M2OWRlMzYyZTBhNGJjMWRkMzBjODY3YzE0NTU0MGE3MGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.kFG3jnUN6tw6KPOWS4DaioKPdyzTsrI7x6Hlqq3I23M)
Click on Generate
![Screenshot 2024-01-10 at 8 02 41 PM](https://private-user-images.githubusercontent.com/51082957/295666266-1dd5bb1c-3f32-4214-89ea-2d0110fb79ed.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjYyNjYtMWRkNWJiMWMtM2YzMi00MjE0LTg5ZWEtMmQwMTEwZmI3OWVkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRlYmQxNmVkYTUyZTNmYzhjOGY5MTNmYTc2NWNhMGM0YTlmMGIyYzVhMjVlZjU1MDEwNzRlMjU1NjNiYTY2MDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.FEdqJMm3KjGCGXp18eSwHyjV1-KU4o6rd31QKpEsXMk)
Let's copy the Token and add it to GitHub secrets
![Screenshot 2024-01-10 at 8 03 34 PM](https://private-user-images.githubusercontent.com/51082957/295666361-6d2145b5-b73e-4e3e-b910-9ebdbabe12e8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjYzNjEtNmQyMTQ1YjUtYjczZS00ZTNlLWI5MTAtOWViZGJhYmUxMmU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQyMTJkNzJlMmI0ODk0ZjQ4Yzk3OThhYjMzMzQ5Zjk3MmZkZGQzNGFmYTc0ZDYzN2M4M2RlYWY3Y2VkZDRlYTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.w2ccgZ-Cm3w6HNFmHviHocW0ds3KGuvNNGqLdJYKhiM)
Now Go back to GitHub and Paste the copied name for the secret and token
Name: SONAR_TOKEN
Secret: Paste Your Token and click on Add secret
![Screenshot 2024-01-10 at 8 05 26 PM](https://private-user-images.githubusercontent.com/51082957/295667105-e930e589-92f9-48f9-a800-6d38f96f451e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjcxMDUtZTkzMGU1ODktOTJmOS00OGY5LWE4MDAtNmQzOGY5NmY0NTFlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk5Njk0ZmRkMDc1MmQ5ZTFjMjBjNjRlMjE0NmNhMjFkMTllZDQzNzNjYzAyNzIzMjg3ZGRkNDg1M2ZkODI3MjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.PdlmJ7Kx2ShR8pISBAxLTU5SNhnEELOBp80yJl3T5z0)
Now go back to the Sonarqube Dashboard
Copy the Name and Value
![Screenshot 2024-01-10 at 8 06 09 PM](https://private-user-images.githubusercontent.com/51082957/295667159-d53b22d4-8224-4a09-8e85-5223e7e0614d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjcxNTktZDUzYjIyZDQtODIyNC00YTA5LThlODUtNTIyM2U3ZTA2MTRkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc5MzM2NWZiZTYwMTI0N2MzZGM5M2UwNDdmMWZkODMyZjY2OTUzNjBlOGJjODg4MGZkYWEzMmFlOGE0MTFjY2EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.l9tOsRD_jJOJvFxfHKiyqd38N6sXsFxnBU2W2yJnc_s)
Go to GitHub now and paste-like this and click on add secret
![Screenshot 2024-01-10 at 8 07 25 PM](https://private-user-images.githubusercontent.com/51082957/295667249-a856f7f0-161d-410d-895b-53166bd396a0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjcyNDktYTg1NmY3ZjAtMTYxZC00MTBkLTg5NWItNTMxNjZiZDM5NmEwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQzY2U3ZjhkY2NhOWRkYzFhYmRmNjVhZjIwMWRlYjc0YmJiOTUzZTI2MzI5N2QwNWVmZDEyMmMzOGRjNmEwOTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nQe2Tb54om2ORp49L5K9KIgW8VUtRCCdThic0B5KvV0)
Our Sonarqube secrets are added and you can see it.
![Screenshot 2024-01-10 at 8 07 57 PM](https://private-user-images.githubusercontent.com/51082957/295667324-68bdeb7e-e3f6-43d2-8c56-f6e2738716e2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjczMjQtNjhiZGViN2UtZTNmNi00M2QyLThjNTYtZjZlMjczODcxNmUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQxZTBkOTQ5NzEwZTM3Y2M2YWY1MzBjNGJmOWE0YmFhODVmMjAxZTdmNGZjOWI3YjY5YmEwZTQ2N2I2ZTMxNWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.gFuf-agOQTupwyhHjdQpnKdr3mWPbiLxI7L-0hSiEnw)
Go to Sonarqube Dashboard and click on continue
![Screenshot 2024-01-10 at 8 09 43 PM](https://private-user-images.githubusercontent.com/51082957/295667359-c759439e-8116-4c43-a32f-7e9881a0dcf5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjczNTktYzc1OTQzOWUtODExNi00YzQzLWEzMmYtN2U5ODgxYTBkY2Y1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlmMzQ2NGU5NTNiNTRmYjE5M2UwOTkyZjM1NTM5ZGJhODc0ZWZlYzBlNjJmMzE5MjhjY2VlMjczZmFhY2YyODEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.L9xEsZNNaU3tgeb3ya7QH6RLcun4lUhPKTXLOSt9bFk)
Now create your Workflow for your Project. In my case, I am using React Js. That's why I am selecting Other.
![Screenshot 2024-01-10 at 8 09 43 PM](https://private-user-images.githubusercontent.com/51082957/295667416-f87fc350-9566-433a-a375-192cd8ab9d9d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2Njc0MTYtZjg3ZmMzNTAtOTU2Ni00MzNhLWEzNzUtMTkyY2Q4YWI5ZDlkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZjMjlkMjJkNTk4MjZiZjA2ZmIzYWY4MjdmYWEyOTUzMTc5NGExYzI0MjVlMTllYzZlMGU2YjQ3NjNlNDllNTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.uCiCRF-TjfAc0GpN-OPogzmPxJPWl4Ie90rD4qdrElY)
Now it Generates and workflow for my Project
Note: Make sure to use your files for this Section.
Go back to GitHub. click on Add file and then create a new file
![Screenshot 2024-01-10 at 8 10 25 PM](https://private-user-images.githubusercontent.com/51082957/295667437-182c70e7-d440-4c4c-9cbb-19dde5d88abd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2Njc0MzctMTgyYzcwZTctZDQ0MC00YzRjLTljYmItMTlkZGU1ZDg4YWJkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM2NTlhYjE0Mzc0ZTE2NzZlYmVkNDliMGUxM2FjOWIyZDZmMzc4NjRlNDFhNWMzYzViY2QwMWEwODI0NTVlMTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.4stFDRtdD63Im960fT-HnzfHlDEkPvtH8itdGAeQchM)
Go back to the Sonarqube dashboard and copy the file name and content
![Screenshot 2024-01-10 at 8 12 07 PM](https://private-user-images.githubusercontent.com/51082957/295667474-b1812f28-f682-46d0-b46c-68f81affdcbb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2Njc0NzQtYjE4MTJmMjgtZjY4Mi00NmQwLWI0NmMtNjhmODFhZmZkY2JiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI1ZTBmZTQyYWEzYjYyMDVmMGUyODAwM2VmMmNkZmY1Yjk0YmQ0ZjMyNmY3MTcyMTllYzA2Yjc0ZDRhYzBiY2EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.6YWOwQ5SXAgNcYd9Uc37SSThN-iTR89H0UY048k1zTs)
Add in GitHub like this (Look at image)
![Screenshot 2024-01-10 at 8 13 31 PM](https://private-user-images.githubusercontent.com/51082957/295667507-3d2b49ef-67be-4b32-a010-6e5b34cbfaa7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2Njc1MDctM2QyYjQ5ZWYtNjdiZS00YjMyLWEwMTAtNmU1YjM0Y2JmYWE3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU4ZjM3NmIzYWE5NmFjN2ZhM2Q0MmVkOTkyMWVmOTQ2OGNjMzAyM2EyN2JlNTA3NjJlMzZjNDlmYTE2YThhNzUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.6j3a5qUKik9DkrhSmnClTESl81sIbRGSZ4DXCYWSh1k)
Let's add our workflow
To do that click on Add file and then click on Create a new file
![Screenshot 2024-01-10 at 8 10 25 PM](https://private-user-images.githubusercontent.com/51082957/295667670-dcb600be-e92f-466c-8b98-99c88cb6059e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2Njc2NzAtZGNiNjAwYmUtZTkyZi00NjZjLThiOTgtOTljODhjYjYwNTllLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdhMzY2N2UzZGUyNmNjYzgwZGY1YzYyZGRlZmI0ZjI5NmRiZjk2NmVmOTI4ZjY5ZjEwYmFhYmE4OWIyZTVjZWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ZSC0_OWmj3ZNao-CTXoDghFIDrghCr3ThC_BxJ8MwxU)
Here is the file name
.github/workflows/sonar.yml #you can use any name I am using sonar.yml
Copy content and add it to the file
name: Sonar Code Review Workflow
on:
push:
branches:
- main
jobs:
build:
name: Build
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
![Screenshot 2024-01-10 at 8 16 17 PM](https://private-user-images.githubusercontent.com/51082957/295667919-4a733d20-d012-46bc-a374-bf633f545836.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2Njc5MTktNGE3MzNkMjAtZDAxMi00NmJjLWEzNzQtYmY2MzNmNTQ1ODM2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYwMjFhY2U4NTUxMmUzZDJiNWM4YmMyYWIzM2ZjMjlkY2EzZDQzYWY0M2RhYTViZTc0ODFjZWU3OWY3ZWIwZDUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.H-3fW7CyXSEdulA6sDZkD7miFeDX4KqcdLB49P9l7uE)
Click on commit changes
![Screenshot 2024-01-10 at 8 16 59 PM](https://private-user-images.githubusercontent.com/51082957/295668046-ae20cee1-355e-4de4-be62-3217923e6ecd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjgwNDYtYWUyMGNlZTEtMzU1ZS00ZGU0LWJlNjItMzIxNzkyM2U2ZWNkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQxYjA4YjU4YzE4MmRkZGQ2YjUzOGI2ZWRhNjI0OTUzMGVmMmQzYThlMzVhYmI4M2FmOTEzYzg1ODMzNjNjMDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._kR0r0f_Hv2eD3zxcJFJ3ogMMGnCd_SCc36_jqHw-nw)
Now workflow is created.
Start again GitHub actions runner from the Ec2 instance Run These Commands
cd actions-runner
./run.sh
Click on Actions now
Now it's automatically started the workflow
![Screenshot 2024-01-10 at 8 19 23 PM](https://private-user-images.githubusercontent.com/51082957/295668101-a74f8c0d-42f3-4aa2-99e5-d6dd6a3b64e4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjgxMDEtYTc0ZjhjMGQtNDJmMy00YWEyLTk5ZTUtZDZkZDZhM2I2NGU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNmNTI3NzFiYjJiNzQyMjVlN2Q2YTBmNThiMDY4YzA0NmRiMjliZmUwNTk3NWY4YzRlNDZlMGNlZGM4ZDFiYmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.VB-UHud8Ze1ZMvEvhkZc_xpL8KqsfsuBLjl-cRLa0w4)
Let's click on Build and see what are the steps involved
![Screenshot 2024-01-10 at 8 20 55 PM](https://private-user-images.githubusercontent.com/51082957/295668138-1a1c6a99-c6cd-457c-8697-33a205ba834a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjgxMzgtMWExYzZhOTktYzZjZC00NTdjLTg2OTctMzNhMjA1YmE4MzRhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA3NzM3MjdkYzFhZWIxOTE5OGExNzFiOWRmYTI3MzFiZDI2ZjI3NjIyZGE3ZmY3NmRiYmQ2ODllNzE0YjU3YjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.lpYHfY23Jo4Aj8iLO4in5VxegVDC8evANKO68JwcWEw)
Click on Run Sonarsource and you can do this after the build completion
![Screenshot 2024-01-10 at 8 22 19 PM](https://private-user-images.githubusercontent.com/51082957/295668173-b598f61d-b27e-4a0a-abbf-8f0232befdbe.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjgxNzMtYjU5OGY2MWQtYjI3ZS00YTBhLWFiYmYtOGYwMjMyYmVmZGJlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZmNzVlNTg4MmJjN2VhYzY2MDc0MjAyNGNmYjcwNzAzZTNlNWE3ODlkOGQ1OGNmMTk2YjAzNDk4YzdlYjZjMTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.LHYtLZtOnoaof6N0ltyrMCgVkBOy6s3pJAkIKMNQmIA)
Build complete.
Go to the Sonarqube dashboard and click on projects and you can see the analysis
![Screenshot 2024-01-10 at 8 23 26 PM](https://private-user-images.githubusercontent.com/51082957/295668206-52a8dd42-4c53-4a65-844e-d8a333d6ac6d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjgyMDYtNTJhOGRkNDItNGM1My00YTY1LTg0NGUtZDhhMzMzZDZhYzZkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1NTEyYjBkMzRiNzNjNGMxM2ExNzFkOTJkMmI4NTBmM2M3MTEwMDRkMjY3ZmI0YmU2YWQzMGI5NzRjYWVlN2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.WCfeAsnuOGXnMox557mNPNTlxVRURc8rnUJVQgjE4aI)
If you want to see the full report, click on issues.
Use this script to automate the installation of these tools.
Create script on Your aws ec2.
vim run.sh
Copy the Below given content
#!/bin/bash
sudo apt update -y
sudo touch /etc/apt/keyrings/adoptium.asc
sudo wget -O /etc/apt/keyrings/adoptium.asc https://packages.adoptium.net/artifactory/api/gpg/key/public
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt update -y
sudo apt install temurin-17-jdk -y
/usr/bin/java --version
# Install Trivy
sudo apt-get install wget apt-transport-https gnupg lsb-release -y
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install trivy -y
# Install Terraform
sudo apt install wget -y
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform
# Install AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo apt-get install unzip -y
unzip awscliv2.zip
sudo ./aws/install
# Install kubectl
sudo apt update
sudo apt install curl -y
curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client
# Install Node.js 16 and npm
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/nodesource-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/nodesource-archive-keyring.gpg] https://deb.nodesource.com/node_16.x focal main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt update
sudo apt install -y nodejs
Now Run this script:
chmod +x run.sh
./run.sh
Now Check if these tools are installed or not. By checking Their versions.
kubectl version
aws --version
java --version
trivy --version
terraform --version
node -v
Note: Before starting this part 06, Make sure Terraform and AWS CLI are installed and an aws account is configured on your system. You can see my article to get aws and terraform installation and configuration done.
Now let's clone repo:
https://github.com/codewithmuh/react-aws-eks-github-actions.git
cd react-aws-eks-github-actions
cd terraform-eks
This will change your directory to terraform-eks files.
Now Change your s3 bucket in the backend file. (You can create S3 Bucket on AWS S3)
Now initialize the terraform.
terraform init
![Screenshot 2024-01-10 at 9 51 07 PM](https://private-user-images.githubusercontent.com/51082957/295668278-e008ec6a-504c-411d-8d54-5c65267363bd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjgyNzgtZTAwOGVjNmEtNTA0Yy00MTFkLThkNTQtNWM2NTI2NzM2M2JkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkyNTQ1OTQ5NTViNGUzMDA3MGViODEwNjMwNjRlM2IwZGM1ZWQwY2MxMzA3ZmMxNmY1NjM4OTE5MDZmNjRmNDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Ns0vyiDnCl4CiJPITzIoQNQAgCfIQFVp6zkB9xBQY6w)
Now validate the configurations and syntax of all files.
terraform validate
![Screenshot 2024-01-10 at 9 54 29 PM](https://private-user-images.githubusercontent.com/51082957/295668309-718f9727-1c43-4792-a916-77a15fd3f120.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjgzMDktNzE4Zjk3MjctMWM0My00NzkyLWE5MTYtNzdhMTVmZDNmMTIwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI0OTNkM2Y5ZDJlY2ViZmMxMzI2MjIyODE4ZDVmZWE5NGIyMDIxY2M5NGY1MjVjZmU4MGZhMmNkMzZkYTQwZDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.K0OSnWKHns8lH58iSYEzNEQdXk2KOSpJMR5kUMF_XlE)
Now Plan and apply your infrastructure.
terraform plan
terraform apply
![Screenshot 2024-01-10 at 9 57 37 PM](https://private-user-images.githubusercontent.com/51082957/295668360-852e41d3-7507-40d7-a51f-a8ed09b21a2b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2NjgzNjAtODUyZTQxZDMtNzUwNy00MGQ3LWE1MWYtYThlZDA5YjIxYTJiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU3YzliODdiOWI5MWY4YTkzYTc1OWVlMDQ4ZjhjNTE4NzY5MDA1YWU3N2UyNDc1NDVkNWVhMzYyNDczODIwOWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.WIjTciB4eoyPVxVItDjlknY3N2zZ2AXEMRuWblagl2s)
It can take up to 10 Minutes to create your AWS EKS cluster.
You can check by going to aws EKS service.
![Screenshot 2024-01-10 at 10 14 31 PM](https://private-user-images.githubusercontent.com/51082957/295668428-0a391216-66c4-4a2b-81c6-af9ca89da27b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2Njg0MjgtMGEzOTEyMTYtNjZjNC00YTJiLTgxYzYtYWY5Y2E4OWRhMjdiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM5MzBlMjRmYzkwY2Q2ZDFjZGZjY2FhODRjYTI0NzUzNDU4ZGUyNmM2Y2Q4YTNjOGI3M2YzOGIzYWY0YTc0NjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.udHJ-E1setm7gDBK4-g3JlDPRyWyGXr8j4tnJr0NaR0)
Also, check your Node Grpup EC2 Instance, by going to EC2 Dashboard.
![Screenshot 2024-01-10 at 10 15 25 PM](https://private-user-images.githubusercontent.com/51082957/295668444-bfc92120-34b8-441f-b9f6-4d59ead699d9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU2Njg0NDQtYmZjOTIxMjAtMzRiOC00NDFmLWI5ZjYtNGQ1OWVhZDY5OWQ5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZlN2MyMzYxYWM4YmI3ZTA3MzUwZWU0YTc2ZTE3ZjEzMDhhYTI1YThlMGMwMzQwODU5MjExOWEyMzAzNWU5ZTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ErXVq04M2Byg7rTXCau5Q_w-l9k0ZikqAZ0w7CaGcIA)
Now you have to create a Personal Access token for your Dockerhub account.
Go to docker hub and click on your profile --> Account settings --> security --> New access token
![Screenshot 2024-01-11 at 3 14 48 PM](https://private-user-images.githubusercontent.com/51082957/295900934-0eda48fe-8846-44e5-8d31-9484bc89801c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MDA5MzQtMGVkYTQ4ZmUtODg0Ni00NGU1LThkMzEtOTQ4NGJjODk4MDFjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEwMDY4MjIxZDRlMGYyYjg2ZWEzNTk3NGQ5MGQ0YzIwNzVlM2Y1OGI1Y2Y1NGVjYmViYzY4NjU5ODZlNWIzZDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.NldbI4y2q56JZVq0kvESBXsKJS62mJoQ_7KUqXY37W0)
![Screenshot 2024-01-11 at 3 16 47 PM](https://private-user-images.githubusercontent.com/51082957/295901065-01387808-b200-4ba1-bba8-a5c2504d3a15.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MDEwNjUtMDEzODc4MDgtYjIwMC00YmExLWJiYTgtYTVjMjUwNGQzYTE1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEwNGM0MGM5ZDVhOTE1MTBhNDgwMzRmMzZkY2Q3NzBlYmZhZmVkYWY0NGVlMGUxNjMwNTkyZTFlYWVhZWNmM2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.EXrulWPnJrKAQMBLH2U93hG7sTHxcYAXNHDiHIkFR1k)
Copy This Token.
![Screenshot 2024-01-11 at 3 17 22 PM](https://private-user-images.githubusercontent.com/51082957/295901108-0d04f726-5db6-4926-af08-ccefc4e5ac8d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MDExMDgtMGQwNGY3MjYtNWRiNi00OTI2LWFmMDgtY2NlZmM0ZTVhYzhkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVmNmY1YWQ4Y2MwYTkyNDU4M2Q1YzA5YjQ1ZDY4ODljMzgwOTExNTNmZjFiMjM2M2VhZTlhYjcwNDc1MGRiYjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ItoWXsIZuS1ulZJl6XtHDhCRscJJCgCX-p2TaRrvxiI)
Add this Token to your Github actions Secret.
![Screenshot 2024-01-11 at 3 19 28 PM](https://private-user-images.githubusercontent.com/51082957/295901459-aa180559-88aa-4518-be58-88066b4e49b9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MDE0NTktYWExODA1NTktODhhYS00NTE4LWJlNTgtODgwNjZiNGU0OWI5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ1YjVjN2FmY2Y4MTMxYmIwNjVjOTkzYmE1YjQyMDA2MjM5ZjQwZjJhYTI4N2I0ZDBkMjliNmNkMWFjZWFmZTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.aI8mDSkzb05OJbG8PE4bRctZfvNWmyIHwp7mks80M-4)
Also, add another secret of your dockerhub username.
![Screenshot 2024-01-11 at 3 20 09 PM](https://private-user-images.githubusercontent.com/51082957/295901705-0d0a87dd-e0e5-4174-809b-1b2b3d277f57.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MDE3MDUtMGQwYTg3ZGQtZTBlNS00MTc0LTgwOWItMWIyYjNkMjc3ZjU3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQyNDA4MDc3MDg4YjYzOTg0Y2ZjNDYzZmZiOTljZTFiOTgzNjA4YTM4M2YwY2JiODcxMTUxZjMzOGE0NThkY2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.oB3vjqnxq7pJXXLBbhKqRaqO6gmEphM7u-RVLZgnntw)
Now create a new workflow with the name build.yaml . Make sure to replace the username and image name with yours.
name: Code Build Workflow
on:
workflow_run:
workflows:
- Sonar Code Review Workflow
types:
- completed
jobs:
build:
name: Build
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Docker build and push
run: |
docker build -t react-aws-eks-github-actions .
docker tag react-aws-eks-github-actions codewithmuh/react-aws-eks-github-actions:latest
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker push codewithmuh/react-aws-eks-github-actions:latest
env:
DOCKER_CLI_ACI: 1
![Screenshot 2024-01-11 at 3 34 04 PM](https://private-user-images.githubusercontent.com/51082957/295901867-49d0962d-001b-4d25-928a-6b9691ad5007.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MDE4NjctNDlkMDk2MmQtMDAxYi00ZDI1LTkyOGEtNmI5NjkxYWQ1MDA3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE5NThlYThjNGQxNjdmNTY3YTNjNTVlOTg1ODZhMzk2YWRiNmM2NjViNWJhNWFlMGExZTBmYzRiNTE2MWM4YTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.M_EMF6q4BTBq4FPmBlqWqVtPRRFm1FKutzaKFvBjEBM)
Now you can check image is pushed to your Dockerhub Account.
![Screenshot 2024-01-11 at 3 34 29 PM](https://private-user-images.githubusercontent.com/51082957/295902372-2ebb27ab-7d21-4fa5-8a08-8382ca83f132.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MDIzNzItMmViYjI3YWItN2QyMS00ZmE1LThhMDgtODM4MmNhODNmMTMyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQwMTlkNjhjN2I0YTZlNDZlOGFmNzFiNTliZmI5ODQ0NDAzZTQzNGU1ODI5YTk1NzA5NWVlMzQ5MDdhZGMyNWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._Y833MpCi93cIclzPTNVwOLIj9HDw0KmR74SJxCCssA)
Now add another Workflow for the docker image scan, using the name 'trivy.yml'. Use the content below, but make sure to replace the image with your one.
name: Trivy Image Scan Workflow
on:
workflow_run:
workflows:
- Code Build Workflow
types:
- completed
jobs:
build:
name: Docker Image Scan
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Pull the Docker image
run: docker pull codewithmuh/react-aws-eks-github-actions:latest
- name: Trivy image scan
run: trivy image codewithmuh/react-aws-eks-github-actions:latest
Here is the output of the build.
![Screenshot 2024-01-11 at 4 51 28 PM](https://private-user-images.githubusercontent.com/51082957/295903193-5f5315e3-74d5-4490-9b7b-17c2b69fb32f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MDMxOTMtNWY1MzE1ZTMtNzRkNS00NDkwLTliN2ItMTdjMmI2OWZiMzJmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ0ZWYzYWRjZjE1YmI2MDdlYjZkYWRlNDQyNDBjZGZkZmZhYWEwYWI1ZjhiNjI0MWMwOTdiZWIzYWMxYjc3NTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.JulvcqdVKttbNEjWX2YPz-Rao4jhM6523bjNgrT_c2c)
Now add these lines into build.yml steps, so we can test image on our aws ec2 instance.
- name: Pull the Docker image On AWS EC2 For Testing
run: docker pull sevenajay/tic-tac-toe:latest
- name: Stop and remove existing container
run: |
docker stop react-aws-eks-github-actions || true
docker rm react-aws-eks-github-actions || true
- name: Run the container on AWS EC2 for testing
run: docker run -d --name react-aws-eks-github-actions -p 3000:3000 codewithmuh/react-aws-eks-github-actions:latest
When Build is completed , visit the websiet in your browser.
Note: Make sure port 3000 is added on your Ec2.
"Your_EC2_IP:3000"
![Screenshot 2024-01-11 at 5 27 04 PM](https://private-user-images.githubusercontent.com/51082957/295912156-9e777278-d9c9-438a-9d41-086f558ac1f6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MTIxNTYtOWU3NzcyNzgtZDljOS00MzhhLTlkNDEtMDg2ZjU1OGFjMWY2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdkNWMzYmMyZWMzZDIxODJjYWYxYmJlNjE1M2JhYTNhN2UzM2M0ZGE1MTFkZGJiY2I4YzE1MDM1NDE4MmY3MDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ppvg7X9-vV70x0A4O_TLC0-ek21Um2PzUhVQBt6jmCc)
If it's not working, Try to pull an image on your system and check for errors. Fix them then build the GitHub actions again.
Now create our final deploy.yml file to deploy on aws eks.
And Paste this content there. (Do not commit yet, commit it after part 09)
Note. Make sure to repalce cluster name and region nname with your one.
name: Deploy To EKS
on:
workflow_run:
workflows:
- Code Build Workflow
types:
- completed
jobs:
build:
name: Docker Image Scan
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Pull the Docker image
run: docker pull codewithmuh/react-aws-eks-github-actions:latest
- name: Update kubeconfig
run: aws eks --region us-west-1 update-kubeconfig --name EKS_cluster_codewithmuh
- name: Deploy to EKS
run: kubectl apply -f deployment-service.yml
This will updates the kubeconfig to configure kubectl to work with an Amazon EKS cluster in the region with the name of your cluster, Also deploys Kubernetes resources defined in the deployment-service.yml file to the Amazon EKS cluster using kubectl apply.
No Go to Your Slack and create a new channel for notifications.
Now Click on your slack account name --> settings & Administration --> Manage Apps
![Screenshot 2024-01-11 at 5 47 08 PM](https://private-user-images.githubusercontent.com/51082957/295934318-56bd24f5-f055-462f-9491-45828588edba.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzQzMTgtNTZiZDI0ZjUtZjA1NS00NjJmLTk0OTEtNDU4Mjg1ODhlZGJhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYxNjM5YzljNDhiMDI4ZThjM2FjYTQ2ZTJkNDVjYTk3ZDI4YzRiNGNmZjhhMDQ1YzgwZDVkN2FmN2IwZWIyMjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.dENrrw23yNHFaesnEU_3cNau8WyrfU-hna3kcmKgQnM)
t will open a new tab, select build now
![Screenshot 2024-01-11 at 5 48 09 PM](https://private-user-images.githubusercontent.com/51082957/295934465-e65abe0e-e89d-449f-93c5-a3396eda62f8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzQ0NjUtZTY1YWJlMGUtZTg5ZC00NDlmLTkzYzUtYTMzOTZlZGE2MmY4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNjNzI3MTZhODM3YzhkNjZhZDJhNjAzNTVhYjI0YjdmN2E4MTI4ZjViMTk3MTU0NjNhYjNhNWQ3Y2FmN2NmZTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ew1Jl_UeEab3PEEvRhq42B-te0QkGOQlNLaq7OrsHKg)
Now Click on Create an app
![Screenshot 2024-01-11 at 5 48 35 PM](https://private-user-images.githubusercontent.com/51082957/295934578-d7bee46f-c338-485f-a7db-8239ca1409d3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzQ1NzgtZDdiZWU0NmYtYzMzOC00ODVmLWE3ZGItODIzOWNhMTQwOWQzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU0ZDc3NWIzMDYzMDQ4MDkwNDcyNWRiN2E4NWIyM2YwYWNjYWU4OGMwZjFjNTk5ZTliMDYyZTYyMGMxMGJiZTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.9p-S03UsZ16DoaxdFmgf8rm_nLdMVGYtU7ZMub8JWtY)
Select from scratch
![Screenshot 2024-01-11 at 5 49 04 PM](https://private-user-images.githubusercontent.com/51082957/295934668-c7c4b802-4f08-462f-91cf-34c1adcdf0a1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzQ2NjgtYzdjNGI4MDItNGYwOC00NjJmLTkxY2YtMzRjMWFkY2RmMGExLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQxZDlhMjYxODZjY2RmYjAyN2RlNjdiNjEyYmE2ZTMyNjRmNmYyZTk3OTBkNTY1OTc4ODBhODg1NWJmZDAyZGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.lZQcrU22PDQ0aJ6HirvSYRBmcI2jbvekJNI1iSnpmNE)
Provide a name for the app and select workspace and create
![Screenshot 2024-01-11 at 5 49 54 PM](https://private-user-images.githubusercontent.com/51082957/295934728-af85162c-b5eb-4a48-b13c-0cf5f8b1ca54.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzQ3MjgtYWY4NTE2MmMtYjVlYi00YTQ4LWIxM2MtMGNmNWY4YjFjYTU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQxMTEyMzAzNzI5NjEyNjk0MWQ4YTk5MzFhNmI5OTc3NWI4NWRlZjNmNzczMTIzZWIwNzc1MDUyNzhmZWExY2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RYcfSkrl09FTZzXMpTHmPHdf3DuYBOXtQIpkytbBMB0)
Select Incoming webhooks
![Screenshot 2024-01-11 at 5 50 30 PM](https://private-user-images.githubusercontent.com/51082957/295934794-6d1f446e-9fcb-46a2-98e6-5eec644f7f3a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzQ3OTQtNmQxZjQ0NmUtOWZjYi00NmEyLTk4ZTYtNWVlYzY0NGY3ZjNhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY1ZDA3Mjg0NjBhNDM3NDRmNDRmOThiMTcyM2I2NmYxNWExZThiYmM1NDdlZmFiZjc3MGVhMTFiNDRiYzI1MTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.p2FivghLI3WZARkI7I4598xtAYJ0Asg6R4pW9U7t4S0)
Now Set incoming webhooks to on
![Screenshot 2024-01-11 at 5 51 03 PM](https://private-user-images.githubusercontent.com/51082957/295934896-189fa346-e0eb-4ecf-a76d-8a81652c4c32.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzQ4OTYtMTg5ZmEzNDYtZTBlYi00ZWNmLWE3NmQtOGE4MTY1MmM0YzMyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVkYWMyMDc2Y2VkNzYwMjlkY2QxNjQyYWM0OGM5NjRiMzQxNGNhM2EzODQwNzkxNGY4MWYyMDQ1OGNjMjVlMjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.YCS58puw75e3R4xDP7r5eK9xuNoZ-HLfyuvttoSmC4s)
Click on Add New webhook to workspace
![Screenshot 2024-01-11 at 5 51 38 PM](https://private-user-images.githubusercontent.com/51082957/295934970-563d3cc3-a81a-4e5e-9e68-27d23b5a2d5d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzQ5NzAtNTYzZDNjYzMtYTgxYS00ZTVlLTllNjgtMjdkMjNiNWEyZDVkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMwMzMyOTI4ZDM3Yjc3NjllNDJlNDY5OWM3YWFiNjliMjRmMjI1Y2M2YTFlZDAyNzAzZWY3ZjU3ODAzOWJlMzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.4z8zAb-b5kkBExHTODQjXSA40yi03Ji8k2h29ZO-yGU)
Select Your channel that created for notifications and allow
![Screenshot 2024-01-11 at 5 52 12 PM](https://private-user-images.githubusercontent.com/51082957/295935086-9a028aaa-55f5-4ce1-b16e-2d3c4bf2e0e4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzUwODYtOWEwMjhhYWEtNTVmNS00Y2UxLWIxNmUtMmQzYzRiZjJlMGU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI1ZmI4OWRlZTMxMGE0MTBiZWQyMzU2MDEyNjQ4NTRhMTQzYzQ3ZDE0Nzc3YmRkYmJjZGYwMDU3ZmU1ZjcyODAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.iB1b2L1Mj4K422B_mYMtEhkE31oGcWxvD2dlDaAiE6I)
It will generate a webhook URL copy it
![Screenshot 2024-01-11 at 5 53 14 PM](https://private-user-images.githubusercontent.com/51082957/295935162-f0b87569-cc5b-4207-8893-4a9f520a82df.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzUxNjItZjBiODc1NjktY2M1Yi00MjA3LTg4OTMtNGE5ZjUyMGE4MmRmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFjOGJmMDk4YTNhODBhNzliMWZkNTBlMmFhNjA3Njg1ZGMwNWI4MWVkNjZiY2YxMTYzZjFkMzcyZWY3NzI1OWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.h3X_fJrEuvfRX0YM6I6XS60oo3QNtUwt2CR-KU3-ofg)
Now come back to GitHub and click on settings
Go to secrets --> actions --> new repository secret and add
![Screenshot 2024-01-11 at 5 56 01 PM](https://private-user-images.githubusercontent.com/51082957/295935226-ea05fc0a-1cea-43ae-b349-ff08a75dff0a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5MzUyMjYtZWEwNWZjMGEtMWNlYS00M2FlLWIzNDktZmYwOGE3NWRmZjBhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRhMWY0Y2ZiNGJlNTkwNThlNTcyYmYxNDBmNDZiNThjZDNlYTUyMDM3MGQ4MDcwNjk4ZTgwYmNiMzdmYmZhZWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.JgRNBwsEtlyBxVfL4wMXJoNCxAIMJFp5wIt1AizdUYM)
Add the below code to the deploy.yml workflow and commit and the workflow will start.
- name: Send a Slack Notification
if: always()
uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#git'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
This step sends a Slack notification. It uses the act10ns/slack action and is configured to run "always," which means it runs regardless of the job status. It sends the notification to the specified Slack channel using the webhook URL stored in secrets.
If you get this error, Try to configure aws cli on the ec2 instance to resolve this matter.
![Screenshot 2024-01-11 at 8 57 56 PM](https://private-user-images.githubusercontent.com/51082957/295976673-9f83d0e3-81b8-49a0-82ec-8e3d54f63c6e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5NzY2NzMtOWY4M2QwZTMtODFiOC00OWEwLTgyZWMtOGUzZDU0ZjYzYzZlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU2MWU4NjU0YWQwOTM4YWM5ZjU5NzU0ZDYzY2MxYjM1NDU0OWY3M2Y1ZjQ5ZGQ2MzRiMzBmOTBkZDExNDQ0ZDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._vgUHNXnJXTMtxKaSji1qRc6sB1Cg7uiS_KeIPX0rj8)
Now our build is completed.
![Screenshot 2024-01-11 at 9 17 57 PM](https://private-user-images.githubusercontent.com/51082957/295979635-69a5cdea-b740-4a2d-8d64-288f11688192.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5Nzk2MzUtNjlhNWNkZWEtYjc0MC00YTJkLThkNjQtMjg4ZjExNjg4MTkyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTEwNzZiZWE4MDgxMWQzZGQxYmEyMWM3YzEyOGQ5NWIwYWFiYmFiMWEyMzYyMzA0ZjFhYzc4NjlhNTJhMDMxZmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._5nc4vw6VM5Ht2PaZWnhj25BG9bPXgKJQmCXxLPs4x0)
And here is the Slack notification.
![Screenshot 2024-01-11 at 9 14 47 PM](https://private-user-images.githubusercontent.com/51082957/295979182-9bea4559-64f0-49db-8054-6b57ba7583b6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5NzkxODItOWJlYTQ1NTktNjRmMC00OWRiLTgwNTQtNmI1N2JhNzU4M2I2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU3YmVmODUzMzdjZTYxMGYwMjE1ZTI3MGFkYjkxYjkyMTFhMzEyMjYxMmQyYTg3MTY4ZWMzNThkNDkzMGY0ODgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.77VOVFTxa6zOOXOi248qh1PCk65-Exi_itBAxKz16OE)
Let’s go to the Ec2 ssh connection
Rn this command.
kubectl get all
Open the port in the security group for the Node group instance.
After that copy the external IP and paste it into the browser
Here is the Output: The website is Live.
![Screenshot 2024-01-11 at 9 23 35 PM](https://private-user-images.githubusercontent.com/51082957/295981232-dec57ac6-922e-4803-b30c-224264129227.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwOTgyMzIsIm5iZiI6MTcyMzA5NzkzMiwicGF0aCI6Ii81MTA4Mjk1Ny8yOTU5ODEyMzItZGVjNTdhYzYtOTIyZS00ODAzLWIzMGMtMjI0MjY0MTI5MjI3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA4VDA2MTg1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRmOWUyYjFhMTFlMjYxZWFhNTQ0YTk1ZTg1OGUwN2MzMjBlNTRmMmY3YTkwZjU3ODY3YjdkYmU5ZTM1YjUyOGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.C_HbMOOn8-fwuOrKveBWT5LKAL3eV02DvEcE29mxqOg)
Part 10: Delete the infrastructure (To Avoid Extra Billing, if you are just using it for learning Purposes)
To destroy, Follow these Steps:
-
comment this line run: kubectl apply -f deployment-service.yml in deploy.yaml, adn add this line run: kubectl delete -f deployment-service.yml . You can say it replacement between lines. It will delete the container and delete the Kubernetes deployment.
-
Stop the self-hosted runner.
-
To delete the Eks cluster
cd /home/ubuntu
cd Project_root_folder
cd terraform-eks
terraform destroy --auto-approve
Then Delete ths dockerhub token. Once cluster is destroyed, delete the ec2 instance and iam role.
Special thanks to codewithmuh for creating this incredible Devops Project and simplifying the CI/CD process.