-
Notifications
You must be signed in to change notification settings - Fork 13
Setup CI Pipeline
Rahul Kumar edited this page Sep 21, 2023
·
14 revisions
- GitHub Actions
- Docker and Docker Compose
- OEDF and Gradle
- DGoss to test Docker image state
- Trivy for running Security scans of the Docker containers
- Mocha to test PASOE Services
- HTML, JavaScript, and JSDO for Web app
- Get the Ubuntu VM details,
- VM Hostname
- PEM file
- Open
Command Prompt
terminal and navigate to the directory where PEM file is located. Then run the below commandssh -i "<pem-file>" ubuntu@<hostname>
This is the runner where your CI pipeline will run. Let's configure and set up this runner.
- Go to the GitHub repo page in a browser
- Navigate to the
Settings
tab ->Actions
->Runners
- Click on the
New self-hosted runner
- Select
Linux
on theRunner image
section - Go to the Ubuntu VM terminal and perform the below steps
cd /opt sudo mkdir actions-runner/ sudo chown ubuntu actions-runner/ cd actions-runner
- Now, follow the steps from GitHub
Add new self-hosted runner
page - Confirm that the runner is added in GitHub (Settings -> Actions -> Runners)
- Start the runner as a service
- Check the
.env
file to have the variables- JAVA_HOME=/opt/java/jdk-17.0.8.1+1
- DLC=/psc/dlc
- Use the below commands
sudo ./svc.sh install // install the runner; only needed for the 1st time sudo ./svc.sh start // then start it sudo ./svc.sh status // to check status sudo ./svc.sh stop // to stop the Gradle runner
- Check the
Now you can start creating Job
for your CI pipeline.
- Navigate to
/home/ubuntu
- Copy and update the certificate for the Nexus repo. (Already created and placed in this directory)
sudo cp nexus.crt /usr/local/share/ca-certificates/nexus.crt sudo update-ca-certificates sudo systemctl restart docker //restart docker
- Test by trying docker pull one of the images from Nexus
docker pull ec2-54-80-142-101.compute-1.amazonaws.com:9443/openedge-pasoe:12.8.0
(Reference - https://docs.docker.com/registry/insecure/#docker-still-complains-about-the-certificate-when-using-authentication)
- Configure the below secrets (
Settings
->Secrets and variables
->Actions
)- DOCKER_USER=<user-name> - DOCKER_PWD=<password>
- Configure the below variables (click on the
Variables
tab)- APP_GROUP=<company-name>/<your-name> //keep the values in small case - APP_NAME=sports - APP_VERSION=latest - DOCKER_REPO_URL=ec2-54-80-142-101.compute-1.amazonaws.com:9443 - NEXUS_URL=https://ec2-54-80-142-101.compute-1.amazonaws.com:8443/repository/PugChallengeMaven - OE_VERSION=12.8.0
- Open the GitHub checked-out folder in VSCode on the Windows VM
- Create a file,
.github\workflows\development.yml
(at the root location of the repo) - Copy the content to this generated file
- Navigate to
.github\workflows\development.yml
file indevelop
branch in the GitHub from browser - Copy the content from this file and paste it into the YAML created in your repo
- Navigate to
Now let's go through various sections in the YAML file.
- Check for
compile
insidejobs
- Go through the steps inside this section
Notice the docker run command that brings up the dev PAS container to do compilation.
- Check for
build
insidejobs
- Go through the steps inside this section. Get an understanding of how the Docker image is created for the Sports app, which will get used during deployment
- Check for
buildwebui
insidejobs
- Update the
serviceURI
inwebui\src\grid.js
file to point to the hostname of your GitHub runner instance- Should look something like -
var serviceURI = "https://ec2-3-84-2-121.compute-1.amazonaws.com:8811/Sports";
- Go through the steps
- Check for
deploy
insidejobs
- Update
serviceURI
andcatalogURI
intest-app-image\test\testCustomer.js
file to point to the hostname of your GitHub runner instance - Go through the steps
- Check the steps
- Understand how the deployment is done
- Understand how the tests are hooked in to run against the deployed app
- Check for
securityscans
insidejobs
- Check the steps and explore reporting
- Check for
stage
insidejobs
- Notice how a
tested
tag is appended to identify the artifact as tested
- Hit the Service URL
https://<ubuntu-hostname>:8811/Sports/rest/SportsService/Customer
- Hit the Web App URL
http://<ubuntu-hostname>:8080/
- Play around with the app
- Make new changes to
- Changes can be in the
webui
- Changes can be in the business logic of the
Sports
app
- Changes can be in the
- Commit to the GitHub repo and let the CI run
- Validate the changes