From b8132b2a68fc73766923ed12ff5880b9f64592fd Mon Sep 17 00:00:00 2001 From: Josral04 Date: Sun, 16 Mar 2025 20:02:14 -0600 Subject: [PATCH 01/47] Add files via upload Read Me File --- Description.md | 108 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 Description.md diff --git a/Description.md b/Description.md new file mode 100644 index 000000000..1afc653ab --- /dev/null +++ b/Description.md @@ -0,0 +1,108 @@ +# ENSF 400 - Winter 2025 - Course Project + +## Project Overview + +In this project, you will work based on a software project by incorporating/extending a complete CI/CD (Continuous Integration/Continuous Deployment) pipeline. This is based on an open-source sample application: https://github.com/7ep/demo + +This project can also be any application that requires the project of build, test, and deployment. +You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. + + +## Project Requirements + +By the end of this project, your group must deliver the following: + +1. Manage your project on GitHub and follow proper Git workflows (branching, pull requests, code reviews). Document the process of how you use Git workflows to collaborate with your team members. + +1. Containerize your application for builds and deployments. Upload and download your container images to a public or private image repository (e.g., Docker Hub or GitHub Container Registry). Ensure a container image is built with unique build tag(s) matching the triggering commit from any branch. + +1. Set up an automated CI/CD with Jenkins in a Codespace environment. Configure the pipeline to trigger upon pull requests merging changes into the main branch. + +1. Document the CI/CD process and provide clear instructions on replicating your environment. Submit a video demo at the end of the project. + +### Existing Pipelines +You will also demonstrate the delivery of the following process and artifacts that come with the project. + +1. Run static analysis quality-gating using SonarQube +1. Performance testing with Jmeter +1. Security analysis with OWASP's "DependencyCheck" +1. Build Javadocs + + +## Evaluation Criteria + +Your project will be assessed on the following criteria: + +### GitHub Repository & Git Workflow (15%) +1. Project on GitHub in a public repository with all team members participating in the development and maintenance of the project (5%). +1. Demonstrate the process practicing Git workflows (branching, pull requests, code reviews) (10%). + +### Containerization (20%) +1. Dockerfile to containerize the project (5%). +1. Use of container image repository to upload and download images (5%). +1. Effective tagging mechanism for each building matching the commits/branches/pull requests (10%). + +### CI/CD Pipeline Automation (40%) +1. Jenkins integration with GitHub in Codespace (10%). +1. Triggering automated checks upon pull request to the main branch (10%). +1. Deployment process to automatically deploy the application in the Codespace environment upon a build (10%). +1. Be able to run items 5-8 in **Existing Pipelines** (10%). + +### Testing & Code Quality (10%) +1. Generate test coverage reports upon each automated build (5%). +1. Generate code quality report using SonarQube reports upon each automated build (5%). + +### Documentation & Demo (15%) +1. Clarity and completeness of README and other documentation. The documentation must demonstrate the team’s collaboration process (5%). +1. Demonstration video with a length not exceeding 10 minutes, showing a clear understanding of the pipeline and its benefits. The documentation must demonstrate the team’s collaboration process (10%). + +_______________________________________________________________________________________________________________________________________________________________________________________________________________ + +# Organization of our ENSF 400 CI/CD Project + +## Team Members +- Josral Frederick UCID: 30195360 +- Muhammad Aun Raza UCID: 30172183 +- Natnael Tekli UCID: 30171167 +- Jaden Chow UCID: 30173676 + + +## Project Description +The main objective in this project is to create software that incorporates/extends a complete CI/CD +(Continuous Integration/Continuous Deployment) pipeline. + +## Git Workflow +- **Branching Strategy**: +We will use a Feature Branching Strategy, where each new feature or bug fix is developed in its own branch. +- The main branch will be called ‘main' +- Development branches will follow the naming convention ‘feature/[feature-name]’ for features +- Finally ‘bugfix/[bug-name]’ for bug fixes. + +- **Pull Requests**: + Upon completion of a feature, developers will create a pull request (PR) from their `feature` branch + to the `main' branch. Each PR will contain a description of the changes made and link to any relevant issues. + The PR will be reviewed by at least one team member before merging. + +- **Code Reviews**: + The code review will take place within the Github interface. Each PR will be reviewed by atleast one team member before being merged to the main branch. The reviewer will + make sure the PR is in accordance with the project requirements and necessary discussions will take place within the request. + +## Containerization +- **Dockerfile**: + A Dockerfile is a set of instructions to automate the creation of a Docker Image. The Dockerfile helps containerize the application, ensuring it is built, tested and deployed. + This is done by packaging the application into a container, works with Kubernetes and enables automation in the CI/CD pipeline. + +- **Image Repository**: Instructions for pushing/pulling images and how tagging works. +Container images will be pushed to **Docker Hub**. To push an image, use the following command: + ```bash + docker push /task-manager-app: + +## CI/CD Setup +- **Jenkins Configuration**: Explain the integration with GitHub and how the pipeline is set up. + +## Running the Project +Instructions for running the application locally, including prerequisites. + +## Testing +- **Testing Framework**: Briefly describe tools used for testing. +- **Code Quality Reports**: Link to generated SonarQube reports. From 61d5faea1e35d6a6fe9fb72841d268172c08934d Mon Sep 17 00:00:00 2001 From: Jaden Chow Date: Sun, 16 Mar 2025 20:04:11 -0600 Subject: [PATCH 02/47] Fixed BDD_video.mp4 bug fix with change committed --- docs/BDD_video.mp4 | Bin 12191007 -> 12191004 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/docs/BDD_video.mp4 b/docs/BDD_video.mp4 index 27c4646cf01956f75756fca4569d3aedbc1417d6..571239ede95cfe30e98aab42f099e7dc7eba9064 100644 GIT binary patch delta 665 zcmWN=*;$oTM0_k9wjMRd$n&N#bVm6W(xQ701wha zD-ZE7Q+b4GOlJl&d6dVP#cbyAI8X2-b9st+Jk2va%X2)>d|qGyFY*!#S;S(Nu#{yi z=Ve}D1+TKwu$ooQ5WCw|Ww>3{|GeyurD|T|b=L3(Ygxy7-sCOb<{dWhF7L6C_u0f| zK41%5`H+wJm`~Wor?l}I+xeVg2Vc<6m+WL0yV=8D_VE?_`I>L|mhbqU1N^{24snGpG55U-^yS`GY?>!(W`GgTFb)Kb+?Rom`~BzlLMUY=~b5bj@Sp delta 671 zcmWO1*)|ja0Eh827)vOHqD7I&(qgGbo61fhlvF~9HcM2tGV*7bN~J7ig!UMfqG_&r z2Y2%Z-OM}mUHs1ZZaLbXww z6sB-())sBmHbrQ=b|_L&+No&mQjB7?TXBk4f)ceyd$mvdm84{)ET@{BhCqwSnTi8A zh(ji!EK`F{`4(Cyh3#hf5QbsJV?4oAjNlob;{`_X60b0ZaZF$m zuki*`uwfc+F@ssm;T_)N13uytKI03%Vjc^yV-er*9Y3&ypZJAktl&2s_~Wp Date: Sun, 16 Mar 2025 20:08:01 -0600 Subject: [PATCH 03/47] Update Description.md Remove Testing --- Description.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/Description.md b/Description.md index 1afc653ab..b651971e1 100644 --- a/Description.md +++ b/Description.md @@ -103,6 +103,3 @@ Container images will be pushed to **Docker Hub**. To push an image, use the fol ## Running the Project Instructions for running the application locally, including prerequisites. -## Testing -- **Testing Framework**: Briefly describe tools used for testing. -- **Code Quality Reports**: Link to generated SonarQube reports. From 9ff342261b3bd7863ff7510f31c134b0a5fb1a89 Mon Sep 17 00:00:00 2001 From: Natnael Tekli Date: Sun, 16 Mar 2025 20:18:05 -0600 Subject: [PATCH 04/47] updated the file --- Description.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Description.md b/Description.md index b651971e1..6b2b7489c 100644 --- a/Description.md +++ b/Description.md @@ -103,3 +103,11 @@ Container images will be pushed to **Docker Hub**. To push an image, use the fol ## Running the Project Instructions for running the application locally, including prerequisites. + + + +Instructions for running the application locally, including prerequisites. + +## Testing +- **Testing Framework**: Briefly describe tools used for testing. +- **Code Quality Reports**: Link to generated SonarQube reports. From ea22cd5885e0569e233d86b7663fdcec284d7fc9 Mon Sep 17 00:00:00 2001 From: Jaden Chow Date: Sun, 16 Mar 2025 20:26:53 -0600 Subject: [PATCH 05/47] Updated Testing Description Added brief description --- Description.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Description.md b/Description.md index 6b2b7489c..045f83971 100644 --- a/Description.md +++ b/Description.md @@ -110,4 +110,6 @@ Instructions for running the application locally, including prerequisites. ## Testing - **Testing Framework**: Briefly describe tools used for testing. + We have access to automated testing tools integrated into the CI/CD pipeline (Jenkins), these will help with unit, integration, security, and performance + - **Code Quality Reports**: Link to generated SonarQube reports. From 25d2cfda524a9ff4c7bebe2c2dfce01e13f1a30e Mon Sep 17 00:00:00 2001 From: Josral04 Date: Mon, 17 Mar 2025 08:10:59 -0600 Subject: [PATCH 06/47] Rename Description.md to README(2).md --- Description.md => README(2).md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Description.md => README(2).md (100%) diff --git a/Description.md b/README(2).md similarity index 100% rename from Description.md rename to README(2).md From d6b59cc8654e2885305be720c6ab7fc4d0d11445 Mon Sep 17 00:00:00 2001 From: MAunRaza Date: Mon, 17 Mar 2025 12:48:33 -0600 Subject: [PATCH 07/47] Raza Update README(2).md --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index 045f83971..4e96506c1 100644 --- a/README(2).md +++ b/README(2).md @@ -62,7 +62,7 @@ ________________________________________________________________________________ ## Team Members - Josral Frederick UCID: 30195360 -- Muhammad Aun Raza UCID: 30172183 +- Muhammad Aun Raza My UCID: 30172183 - Natnael Tekli UCID: 30171167 - Jaden Chow UCID: 30173676 From aca984eca56adb0f05ddadbc055da811607b28ea Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Mon, 17 Mar 2025 20:36:20 +0000 Subject: [PATCH 08/47] edited the readme file --- README(2).md | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/README(2).md b/README(2).md index 4e96506c1..f02f294a2 100644 --- a/README(2).md +++ b/README(2).md @@ -72,20 +72,24 @@ The main objective in this project is to create software that incorporates/exten (Continuous Integration/Continuous Deployment) pipeline. ## Git Workflow -- **Branching Strategy**: -We will use a Feature Branching Strategy, where each new feature or bug fix is developed in its own branch. -- The main branch will be called ‘main' -- Development branches will follow the naming convention ‘feature/[feature-name]’ for features -- Finally ‘bugfix/[bug-name]’ for bug fixes. - -- **Pull Requests**: - Upon completion of a feature, developers will create a pull request (PR) from their `feature` branch - to the `main' branch. Each PR will contain a description of the changes made and link to any relevant issues. - The PR will be reviewed by at least one team member before merging. - -- **Code Reviews**: - The code review will take place within the Github interface. Each PR will be reviewed by atleast one team member before being merged to the main branch. The reviewer will - make sure the PR is in accordance with the project requirements and necessary discussions will take place within the request. +Our team follows a structured Git workflow to manage our project efficiently on GitHub. + +We begin by cloning the repository using git clone . Before making changes, we create a new feature branch with git checkout -b feature/feature-name to keep our work organized. + +Once changes are made, we stage and commit them using git add . and git commit -m "Description of changes", ensuring clear commit messages. + +To keep our branch up-to-date, we sync it with the main branch by switching to main, pulling the latest changes (git pull origin main), and merging them into our feature branch (git merge main). If merge conflicts arise, we resolve them before proceeding. + +After finalizing our changes, we push our branch to the remote repository using git push origin feature/feature-name. We then open a Pull Request (PR) on GitHub, providing a description of our modifications. + +Team members participate in a code review process, leaving feedback and suggesting necessary improvements. Once approved, the PR is merged into main, typically by a team lead or someone with write access. + +After merging, we delete the feature branch both locally (git branch -d feature/feature-name) and remotely (git push origin --delete feature/feature-name). To stay updated, we sync our local repository with the latest changes using git pull origin main. + +We follow GitFlow best practices, using descriptive branch names (e.g., feature/login-page, bugfix/error-handling) and ensuring every change is reviewed via a PR before merging into main. +External contributors fork the repository, create a new branch, make their changes, and open a PR to contribute to the project. + +This workflow ensures a structured and collaborative development process, keeping our codebase clean and organized. ## Containerization - **Dockerfile**: @@ -97,19 +101,4 @@ Container images will be pushed to **Docker Hub**. To push an image, use the fol ```bash docker push /task-manager-app: -## CI/CD Setup -- **Jenkins Configuration**: Explain the integration with GitHub and how the pipeline is set up. - -## Running the Project -Instructions for running the application locally, including prerequisites. - - - - -Instructions for running the application locally, including prerequisites. -## Testing -- **Testing Framework**: Briefly describe tools used for testing. - We have access to automated testing tools integrated into the CI/CD pipeline (Jenkins), these will help with unit, integration, security, and performance - -- **Code Quality Reports**: Link to generated SonarQube reports. From 54706be1c087f5a5c59aeba3c5564b3da24f95de Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Mon, 17 Mar 2025 14:50:09 -0600 Subject: [PATCH 09/47] Create dockerfile --- dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 dockerfile diff --git a/dockerfile b/dockerfile new file mode 100644 index 000000000..979f41369 --- /dev/null +++ b/dockerfile @@ -0,0 +1,6 @@ +FROM gradle:7.6.1-jdk11 +WORKDIR /ensf400-demo +COPY . . +RUN ./gradlew build +EXPOSE 8080 +CMD ["gradle", "appRun"] From bab5c7038c53b5e7da3ab11a19e6bb16359a15eb Mon Sep 17 00:00:00 2001 From: Josral04 Date: Mon, 17 Mar 2025 15:16:57 -0600 Subject: [PATCH 10/47] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index ff7b120e1..06d04e4c1 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ plugins { // gretty is a gradle plugin to make it easy to run a server and hotswap code at runtime. // https://plugins.gradle.org/plugin/org.gretty - id 'org.gretty' version '3.0.4' + id 'org.gretty' version '3.1.5' // provides access to a database versioning tool. id "org.flywaydb.flyway" version "6.0.8" From 08ac2fb8149e22cd5b24af0cd401bc4b27579585 Mon Sep 17 00:00:00 2001 From: Natnael Tekli Date: Mon, 17 Mar 2025 22:16:14 -0600 Subject: [PATCH 11/47] edited the readme file --- README(2).md | 49 ++++++++++--------------------------------------- 1 file changed, 10 insertions(+), 39 deletions(-) diff --git a/README(2).md b/README(2).md index f02f294a2..96a3ab31d 100644 --- a/README(2).md +++ b/README(2).md @@ -21,52 +21,25 @@ By the end of this project, your group must deliver the following: 1. Document the CI/CD process and provide clear instructions on replicating your environment. Submit a video demo at the end of the project. ### Existing Pipelines + You will also demonstrate the delivery of the following process and artifacts that come with the project. 1. Run static analysis quality-gating using SonarQube 1. Performance testing with Jmeter 1. Security analysis with OWASP's "DependencyCheck" 1. Build Javadocs - - -## Evaluation Criteria - -Your project will be assessed on the following criteria: - -### GitHub Repository & Git Workflow (15%) -1. Project on GitHub in a public repository with all team members participating in the development and maintenance of the project (5%). -1. Demonstrate the process practicing Git workflows (branching, pull requests, code reviews) (10%). - -### Containerization (20%) -1. Dockerfile to containerize the project (5%). -1. Use of container image repository to upload and download images (5%). -1. Effective tagging mechanism for each building matching the commits/branches/pull requests (10%). - -### CI/CD Pipeline Automation (40%) -1. Jenkins integration with GitHub in Codespace (10%). -1. Triggering automated checks upon pull request to the main branch (10%). -1. Deployment process to automatically deploy the application in the Codespace environment upon a build (10%). -1. Be able to run items 5-8 in **Existing Pipelines** (10%). - -### Testing & Code Quality (10%) -1. Generate test coverage reports upon each automated build (5%). -1. Generate code quality report using SonarQube reports upon each automated build (5%). - -### Documentation & Demo (15%) -1. Clarity and completeness of README and other documentation. The documentation must demonstrate the team’s collaboration process (5%). -1. Demonstration video with a length not exceeding 10 minutes, showing a clear understanding of the pipeline and its benefits. The documentation must demonstrate the team’s collaboration process (10%). - -_______________________________________________________________________________________________________________________________________________________________________________________________________________ +___________________________________________________________________________________________________________________________________________________ # Organization of our ENSF 400 CI/CD Project +___________________________________________________________________________________________________________________________________________________ ## Team Members + - Josral Frederick UCID: 30195360 - Muhammad Aun Raza My UCID: 30172183 - Natnael Tekli UCID: 30171167 - Jaden Chow UCID: 30173676 - ## Project Description The main objective in this project is to create software that incorporates/extends a complete CI/CD (Continuous Integration/Continuous Deployment) pipeline. @@ -92,13 +65,11 @@ External contributors fork the repository, create a new branch, make their chang This workflow ensures a structured and collaborative development process, keeping our codebase clean and organized. ## Containerization -- **Dockerfile**: - A Dockerfile is a set of instructions to automate the creation of a Docker Image. The Dockerfile helps containerize the application, ensuring it is built, tested and deployed. - This is done by packaging the application into a container, works with Kubernetes and enables automation in the CI/CD pipeline. - -- **Image Repository**: Instructions for pushing/pulling images and how tagging works. -Container images will be pushed to **Docker Hub**. To push an image, use the following command: - ```bash - docker push /task-manager-app: + +To containerize our application, we use Docker and Docker Hub. After creating and reviewing the Dockerfile as a team, we build the Docker image with a unique tag matching the commit hash or branch name. This ensures traceability by linking each image to the exact code version it was built from. We generate the commit hash using COMMIT_HASH=$(git rev-parse --short HEAD), build the image with docker build -t natnaelt2/ensf400-demo:$COMMIT_HASH ., and push it to Docker Hub using docker push natnaelt2/ensf400-demo:$COMMIT_HASH. This process guarantees consistency and simplifies tracking across deployments. + +To deploy the application, we pull the Docker image from Docker Hub using the command docker pull natnaelt2/ensf400-demo:commit-hash. Finally, we run the Docker container using the command docker run -p 8080:8080 natnaelt2/ensf400-demo:commit-hash. Then visit the application with your browser at http://localhost:8080/demo. + + From 73ea0d2b2fe1ebaf7e446c05f8a84108e5e003ea Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Mon, 17 Mar 2025 22:20:11 -0600 Subject: [PATCH 12/47] Update README(2).md --- README(2).md | 1 - 1 file changed, 1 deletion(-) diff --git a/README(2).md b/README(2).md index 96a3ab31d..49dc444e8 100644 --- a/README(2).md +++ b/README(2).md @@ -31,7 +31,6 @@ You will also demonstrate the delivery of the following process and artifacts th ___________________________________________________________________________________________________________________________________________________ # Organization of our ENSF 400 CI/CD Project -___________________________________________________________________________________________________________________________________________________ ## Team Members From ba30de5520323ac7781996a68e60aad2f8434fb8 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sat, 12 Apr 2025 02:11:18 +0000 Subject: [PATCH 13/47] added the jenkins dockerfile --- .gitignore | 1 + jenkins/Dockerfile | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 jenkins/Dockerfile diff --git a/.gitignore b/.gitignore index 09eb20a68..203c70d89 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,4 @@ node_modules/ .classpath .project .settings/ +jenkins/jenkins_home/ diff --git a/jenkins/Dockerfile b/jenkins/Dockerfile new file mode 100644 index 000000000..f7c8d5e61 --- /dev/null +++ b/jenkins/Dockerfile @@ -0,0 +1,21 @@ +FROM jenkins/jenkins:alpine +USER root +RUN apk add --update docker openrc + +RUN apk add --no-cache \ + openjdk11 \ + bash \ + docker \ + curl \ + unzip +ENV GRADLE_VERSION=7.6 +ENV GRADLE_HOME=/opt/gradle + +RUN mkdir -p ${GRADLE_HOME} && \ + curl -fsSL https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -o /tmp/gradle.zip && \ + unzip /tmp/gradle.zip -d /opt/gradle && \ + rm /tmp/gradle.zip + +ENV PATH="${GRADLE_HOME}/gradle-${GRADLE_VERSION}/bin:${PATH}" + +RUN gradle -v \ No newline at end of file From fc3a8ea15d54c90ebfabffbb3583c46e852ca0e2 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sat, 12 Apr 2025 02:23:58 +0000 Subject: [PATCH 14/47] added the jenkins dockerfile --- jenkins/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/jenkins/Dockerfile b/jenkins/Dockerfile index f7c8d5e61..69f2cc8b4 100644 --- a/jenkins/Dockerfile +++ b/jenkins/Dockerfile @@ -17,5 +17,4 @@ RUN mkdir -p ${GRADLE_HOME} && \ rm /tmp/gradle.zip ENV PATH="${GRADLE_HOME}/gradle-${GRADLE_VERSION}/bin:${PATH}" - RUN gradle -v \ No newline at end of file From 7876866c444c1feff03194072ab9355c7c5d3c0f Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sat, 12 Apr 2025 02:30:35 +0000 Subject: [PATCH 15/47] added the jenkins dockerfile --- jenkins/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/jenkins/Dockerfile b/jenkins/Dockerfile index 69f2cc8b4..92ab42046 100644 --- a/jenkins/Dockerfile +++ b/jenkins/Dockerfile @@ -1,5 +1,6 @@ FROM jenkins/jenkins:alpine USER root + RUN apk add --update docker openrc RUN apk add --no-cache \ From 19f953aca6b2b13ebbae2651f6ae9367fbba7fb7 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sat, 12 Apr 2025 02:58:39 +0000 Subject: [PATCH 16/47] created the docker-compose file --- docker-compose.yaml | 50 +++++++++++++++++++++++++++++++++ jenkins/Jenkinsfile | 68 +++++++++++++++++++++++---------------------- 2 files changed, 85 insertions(+), 33 deletions(-) create mode 100644 docker-compose.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..b09d42545 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,50 @@ +services: + jenkins: + build: ./jenkins + privileged: true + user: root + ports: + - 8081:8080 + - 50000:50000 + container_name: jenkins + volumes: + - /home/codespace:/var/jenkins_home + - /var/run/docker.sock:/var/run/docker.sock + networks: + - dev-network + depends_on: + - sonarqube + + sonarqube: + image: sonarqube:8.9-community + container_name: sonarqube + environment: + - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar + - SONARQUBE_JDBC_USERNAME=sonar + - SONARQUBE_JDBC_PASSWORD=sonar + ports: + - "9000:9000" + volumes: + - sonarqube_data:/opt/sonarqube/data + networks: + - dev-network + + db: + image: postgres:latest + container_name: sonar-db + environment: + - POSTGRES_USER=sonar + - POSTGRES_PASSWORD=sonar + - POSTGRES_DB=sonar + volumes: + - db_data:/var/lib/postgresql/data + networks: + - dev-network + +networks: + dev-network: + +volumes: + jenkins_home: + sonarqube_data: + db_data: diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index d37024fe4..8acb9365e 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -8,6 +8,9 @@ pipeline { // This is set so that the Python API tests will recognize it // and go through the Zap proxy waiting at 9888 HTTP_PROXY = 'http://127.0.0.1:9888' + // Default Java Home for Jenkins (JDK 17) + JAVA_HOME = '/usr/lib/jvm/java-17-openjdk' + PATH = "${JAVA_HOME}/bin:${PATH}" } stages { @@ -15,63 +18,62 @@ pipeline { // build the war file (the binary). This is the only // place that happens. stage('Build') { + environment { + // Override JAVA_HOME to use JDK 11 for this stage + JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' + PATH = "${JAVA_HOME}/bin:${PATH}" + } steps { sh './gradlew clean assemble' } - } - + @@ -23,6 +31,11 @@ pipeline { // run all the unit tests - these do not require anything else // to be running and most run very quickly. stage('Unit Tests') { + environment { + // Override JAVA_HOME to use JDK 11 for this stage + JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' + PATH = "${JAVA_HOME}/bin:${PATH}" + } steps { sh './gradlew test' } - post { - always { - junit 'build/test-results/test/*.xml' - } - } - } - + @@ -36,6 +49,11 @@ pipeline { // run the tests which require connection to a // running database. stage('Database Tests') { + environment { + // Override JAVA_HOME to use JDK 11 for this stage + JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' + PATH = "${JAVA_HOME}/bin:${PATH}" + } steps { sh './gradlew integrate' } - post { - always { - junit 'build/test-results/integrate/*.xml' - } - } - } - - // These are the Behavior Driven Development (BDD) tests + @@ -50,6 +68,11 @@ pipeline { // See the files in src/bdd_test // These tests do not require a running system. stage('BDD Tests') { + environment { + // Override JAVA_HOME to use JDK 11 for this stage + JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' + PATH = "${JAVA_HOME}/bin:${PATH}" + } steps { sh './gradlew generateCucumberReports' // generate the code coverage report for jacoco - sh './gradlew jacocoTestReport' - } - post { - always { - junit 'build/test-results/bdd/*.xml' - } - } - } - + @@ -65,147 +88,15 @@ pipeline { // Runs an analysis of the code, looking for any // patterns that suggest potential bugs. stage('Static Analysis') { - steps { - sh './gradlew sonarqube' - // wait for sonarqube to finish its analysis - sleep 5 - sh './gradlew checkQualityGate' - } - } + environment { + // Override JAVA_HOME to use JDK 11 for this stage + JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' + PATH = "${JAVA_HOME}/bin:${PATH}" + } + + steps{ + sh './gradlew sonarqube -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login="admin" -Dsonar.password="ensf400"' // Move the binary over to the test environment and From c8dffc3c904bc821efe7ec99697268f75095a3a9 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sat, 12 Apr 2025 03:26:42 +0000 Subject: [PATCH 17/47] first test --- .gitignore | 1 + README(2).md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 09eb20a68..203c70d89 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,4 @@ node_modules/ .classpath .project .settings/ +jenkins/jenkins_home/ diff --git a/README(2).md b/README(2).md index 49dc444e8..61866bd68 100644 --- a/README(2).md +++ b/README(2).md @@ -69,6 +69,8 @@ To containerize our application, we use Docker and Docker Hub. After creating an To deploy the application, we pull the Docker image from Docker Hub using the command docker pull natnaelt2/ensf400-demo:commit-hash. Finally, we run the Docker container using the command docker run -p 8080:8080 natnaelt2/ensf400-demo:commit-hash. Then visit the application with your browser at http://localhost:8080/demo. +##Jenkins## + From ac8a144660190ef3aa7c0e0a0f2973fdeb076572 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sat, 12 Apr 2025 05:04:12 +0000 Subject: [PATCH 18/47] second test --- README(2).md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index 61866bd68..c6251c942 100644 --- a/README(2).md +++ b/README(2).md @@ -69,7 +69,8 @@ To containerize our application, we use Docker and Docker Hub. After creating an To deploy the application, we pull the Docker image from Docker Hub using the command docker pull natnaelt2/ensf400-demo:commit-hash. Finally, we run the Docker container using the command docker run -p 8080:8080 natnaelt2/ensf400-demo:commit-hash. Then visit the application with your browser at http://localhost:8080/demo. -##Jenkins## +## Jenkins + From a90772686d7df34166fb4a5813f9f26a943c31e2 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sat, 12 Apr 2025 05:46:24 +0000 Subject: [PATCH 19/47] fixed the jenkinsfile --- jenkins/Jenkinsfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 8acb9365e..bfde46f3e 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -14,7 +14,13 @@ pipeline { } stages { - + + stage('Container Build') { + steps { + sh 'docker build -t ensf400-demo .' + } + } + // build the war file (the binary). This is the only // place that happens. stage('Build') { From dde7a038c03d3738bfcf94093ae1c8b98167a40d Mon Sep 17 00:00:00 2001 From: Jaden Chow Date: Sat, 12 Apr 2025 19:16:14 -0600 Subject: [PATCH 20/47] Triggering Jenkins pull request to trigger jenkins --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index c6251c942..b68d48961 100644 --- a/README(2).md +++ b/README(2).md @@ -70,7 +70,7 @@ To containerize our application, we use Docker and Docker Hub. After creating an To deploy the application, we pull the Docker image from Docker Hub using the command docker pull natnaelt2/ensf400-demo:commit-hash. Finally, we run the Docker container using the command docker run -p 8080:8080 natnaelt2/ensf400-demo:commit-hash. Then visit the application with your browser at http://localhost:8080/demo. ## Jenkins - +Creating branch to trigger jenkins From 6c692df7e5be9f0d9a035d19ef36c152d4f683b9 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 01:34:59 +0000 Subject: [PATCH 21/47] testing the trigger part --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index b68d48961..048a518bb 100644 --- a/README(2).md +++ b/README(2).md @@ -71,7 +71,7 @@ To deploy the application, we pull the Docker image from Docker Hub using the co ## Jenkins Creating branch to trigger jenkins - +one more From 7c9969f352127347b36a0ae58398615b81450a14 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 01:51:02 +0000 Subject: [PATCH 22/47] second try --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index 048a518bb..b68d48961 100644 --- a/README(2).md +++ b/README(2).md @@ -71,7 +71,7 @@ To deploy the application, we pull the Docker image from Docker Hub using the co ## Jenkins Creating branch to trigger jenkins -one more + From 6594f15a7feaf4b04c00fe3ce4f46cc72df2cb53 Mon Sep 17 00:00:00 2001 From: Josral04 Date: Sun, 13 Apr 2025 02:37:46 +0000 Subject: [PATCH 23/47] Added a new branch to connect Jenkins --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index b68d48961..eb7be5dd4 100644 --- a/README(2).md +++ b/README(2).md @@ -5,7 +5,7 @@ In this project, you will work based on a software project by incorporating/extending a complete CI/CD (Continuous Integration/Continuous Deployment) pipeline. This is based on an open-source sample application: https://github.com/7ep/demo This project can also be any application that requires the project of build, test, and deployment. -You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. +You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. Thank you. ## Project Requirements From 57f5a6dbcfecebac0c53126f685986e1422b8c4c Mon Sep 17 00:00:00 2001 From: Josral04 Date: Sun, 13 Apr 2025 02:48:14 +0000 Subject: [PATCH 24/47] Removed changes --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index eb7be5dd4..08c4f85fe 100644 --- a/README(2).md +++ b/README(2).md @@ -5,7 +5,7 @@ In this project, you will work based on a software project by incorporating/extending a complete CI/CD (Continuous Integration/Continuous Deployment) pipeline. This is based on an open-source sample application: https://github.com/7ep/demo This project can also be any application that requires the project of build, test, and deployment. -You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. Thank you. +You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. ## Project Requirements From ffa1e3d4ae7b7cf189c077172c844cfffb94f27e Mon Sep 17 00:00:00 2001 From: Josral04 Date: Sun, 13 Apr 2025 03:53:12 +0000 Subject: [PATCH 25/47] Thank you --- README(2).md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index 08c4f85fe..f312c253a 100644 --- a/README(2).md +++ b/README(2).md @@ -5,7 +5,8 @@ In this project, you will work based on a software project by incorporating/extending a complete CI/CD (Continuous Integration/Continuous Deployment) pipeline. This is based on an open-source sample application: https://github.com/7ep/demo This project can also be any application that requires the project of build, test, and deployment. -You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. +You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. Thank you + ## Project Requirements From 8e82cc0fe4bff1be40c84076197d37e5d48ea975 Mon Sep 17 00:00:00 2001 From: Jaden Chow Date: Sat, 12 Apr 2025 22:00:17 -0600 Subject: [PATCH 26/47] trigger jenkins with public port --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index b68d48961..2052cd792 100644 --- a/README(2).md +++ b/README(2).md @@ -70,7 +70,7 @@ To containerize our application, we use Docker and Docker Hub. After creating an To deploy the application, we pull the Docker image from Docker Hub using the command docker pull natnaelt2/ensf400-demo:commit-hash. Finally, we run the Docker container using the command docker run -p 8080:8080 natnaelt2/ensf400-demo:commit-hash. Then visit the application with your browser at http://localhost:8080/demo. ## Jenkins -Creating branch to trigger jenkins +Creating branch to trigger jenkins with public port From 06e5b19c81a0348a0921d79e6cae166b5adcc1c7 Mon Sep 17 00:00:00 2001 From: Josral04 Date: Sun, 13 Apr 2025 04:03:01 +0000 Subject: [PATCH 27/47] remove --- README(2).md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README(2).md b/README(2).md index f312c253a..114d42883 100644 --- a/README(2).md +++ b/README(2).md @@ -5,8 +5,7 @@ In this project, you will work based on a software project by incorporating/extending a complete CI/CD (Continuous Integration/Continuous Deployment) pipeline. This is based on an open-source sample application: https://github.com/7ep/demo This project can also be any application that requires the project of build, test, and deployment. -You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. Thank you - +You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. ## Project Requirements From 2476d3b839a436963c8a29cda243847690283e6e Mon Sep 17 00:00:00 2001 From: Josral04 Date: Sun, 13 Apr 2025 04:10:37 +0000 Subject: [PATCH 28/47] . --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index 114d42883..3dffa64e4 100644 --- a/README(2).md +++ b/README(2).md @@ -5,7 +5,7 @@ In this project, you will work based on a software project by incorporating/extending a complete CI/CD (Continuous Integration/Continuous Deployment) pipeline. This is based on an open-source sample application: https://github.com/7ep/demo This project can also be any application that requires the project of build, test, and deployment. -You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. +You will leverage GitHub for source control, Docker for containerizing your application, and a CI/CD tool (Jenkins) to automate the build, testing, and verification process. The goal is to validate every code change automatically through container builds, unit tests, code quality checks, and end-to-end functional tests. thank you ## Project Requirements From bf957de007d1e1adaade164fe3f2e959fb4dec23 Mon Sep 17 00:00:00 2001 From: Jaden Chow Date: Sat, 12 Apr 2025 22:18:16 -0600 Subject: [PATCH 29/47] public port different webhook --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index 2052cd792..f09ffe7fd 100644 --- a/README(2).md +++ b/README(2).md @@ -70,7 +70,7 @@ To containerize our application, we use Docker and Docker Hub. After creating an To deploy the application, we pull the Docker image from Docker Hub using the command docker pull natnaelt2/ensf400-demo:commit-hash. Finally, we run the Docker container using the command docker run -p 8080:8080 natnaelt2/ensf400-demo:commit-hash. Then visit the application with your browser at http://localhost:8080/demo. ## Jenkins -Creating branch to trigger jenkins with public port +Creating branch to trigger jenkins with public port again From c4c2acf8379fde080b78c1de909afa8e939879c4 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sat, 12 Apr 2025 23:45:43 -0600 Subject: [PATCH 30/47] Update Jenkinsfile --- jenkins/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index bfde46f3e..64a90aa7d 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -32,7 +32,7 @@ pipeline { steps { sh './gradlew clean assemble' } - @@ -23,6 +31,11 @@ pipeline { + // run all the unit tests - these do not require anything else // to be running and most run very quickly. stage('Unit Tests') { @@ -44,7 +44,7 @@ pipeline { steps { sh './gradlew test' } - @@ -36,6 +49,11 @@ pipeline { + // run the tests which require connection to a // running database. stage('Database Tests') { @@ -56,7 +56,7 @@ pipeline { steps { sh './gradlew integrate' } - @@ -50,6 +68,11 @@ pipeline { + // See the files in src/bdd_test // These tests do not require a running system. stage('BDD Tests') { @@ -68,7 +68,7 @@ pipeline { steps { sh './gradlew generateCucumberReports' // generate the code coverage report for jacoco - @@ -65,147 +88,15 @@ pipeline { + // Runs an analysis of the code, looking for any // patterns that suggest potential bugs. stage('Static Analysis') { From 76fb0976935508e19559307a4b046c6e057fed5b Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 06:13:25 +0000 Subject: [PATCH 31/47] fixed the jenkinsfile --- jenkins/Jenkinsfile | 143 ++++++++++++-------------------------------- 1 file changed, 37 insertions(+), 106 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 64a90aa7d..53645e5fc 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,106 +1,79 @@ -// This jenkinsfile is used to run CI/CD on my local (Windows) box, no VM's needed. - pipeline { - agent any - environment { - // This is set so that the Python API tests will recognize it - // and go through the Zap proxy waiting at 9888 - HTTP_PROXY = 'http://127.0.0.1:9888' - // Default Java Home for Jenkins (JDK 17) - JAVA_HOME = '/usr/lib/jvm/java-17-openjdk' - PATH = "${JAVA_HOME}/bin:${PATH}" - } + environment { + HTTP_PROXY = 'http://127.0.0.1:9888' + JAVA_HOME = '/usr/lib/jvm/java-17-openjdk' + PATH = "${JAVA_HOME}/bin:${PATH}" + } stages { - + stage('Container Build') { steps { sh 'docker build -t ensf400-demo .' } - } - - // build the war file (the binary). This is the only - // place that happens. + } + stage('Build') { environment { - // Override JAVA_HOME to use JDK 11 for this stage JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' PATH = "${JAVA_HOME}/bin:${PATH}" } steps { sh './gradlew clean assemble' } + } - // run all the unit tests - these do not require anything else - // to be running and most run very quickly. stage('Unit Tests') { environment { - // Override JAVA_HOME to use JDK 11 for this stage JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' PATH = "${JAVA_HOME}/bin:${PATH}" } steps { sh './gradlew test' } + } - // run the tests which require connection to a - // running database. stage('Database Tests') { environment { - // Override JAVA_HOME to use JDK 11 for this stage JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' PATH = "${JAVA_HOME}/bin:${PATH}" } steps { sh './gradlew integrate' } + } - // See the files in src/bdd_test - // These tests do not require a running system. stage('BDD Tests') { environment { - // Override JAVA_HOME to use JDK 11 for this stage JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' PATH = "${JAVA_HOME}/bin:${PATH}" } steps { sh './gradlew generateCucumberReports' - // generate the code coverage report for jacoco + } + } - // Runs an analysis of the code, looking for any - // patterns that suggest potential bugs. stage('Static Analysis') { - environment { - // Override JAVA_HOME to use JDK 11 for this stage - JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' - PATH = "${JAVA_HOME}/bin:${PATH}" - } - - steps{ + environment { + JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' + PATH = "${JAVA_HOME}/bin:${PATH}" + } + steps { sh './gradlew sonarqube -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login="admin" -Dsonar.password="ensf400"' + } + } - - // Move the binary over to the test environment and - // get it running, in preparation for tests that - // require a whole system to be running. stage('Deploy to Test') { steps { - sh './gradlew deployToTestWindowsLocal' - // pipenv needs to be installed and on the path for this to work. - sh 'PIPENV_IGNORE_VIRTUALENVS=1 pipenv install' - - // Wait here until the server tells us it's up and listening - sh './gradlew waitForHeartBeat' - - // clear Zap's memory for the incoming tests - sh 'curl http://zap/JSON/core/action/newSession -s --proxy localhost:9888' + sh './gradlew deployToTestWindowsLocal' + sh 'PIPENV_IGNORE_VIRTUALENVS=1 pipenv install' + sh './gradlew waitForHeartBeat' + sh 'curl http://zap/JSON/core/action/newSession -s --proxy localhost:9888' } } - - // Run the tests which investigate the functioning of the API. stage('API Tests') { steps { sh './gradlew runApiTests' @@ -112,12 +85,6 @@ pipeline { } } - // We use a BDD framework for some UI tests, Behave, because Python rules - // when it comes to experimentation with UI tests. You can try things and see how they work out. - // this set of BDD tests does require a running system. - // BDD at the UI level is just to ensure that basic capabilities work, - // not that every little detail of UI functionality is correct. For - // that purpose, see the following stage, "UI Tests" stage('UI BDD Tests') { steps { sh './gradlew runBehaveTests' @@ -130,68 +97,38 @@ pipeline { } } - // This set of tests investigates the functionality of the UI. - // Note that this is separate fom the UI BDD Tests, which - // only focuses on essential capability and therefore only - // covers a small subset of the possibilities of UI behavior. stage('UI Tests') { - steps { - sh 'cd src/ui_tests/java && ./gradlew clean test' - } - post { - always { - junit 'src/ui_tests/java/build/test-results/test/*.xml' - } + steps { + sh 'cd src/ui_tests/java && ./gradlew clean test' + } + post { + always { + junit 'src/ui_tests/java/build/test-results/test/*.xml' } + } } - // Run OWASP's "DependencyCheck". https://owasp.org/www-project-dependency-check/ - // You are what you eat - and so it is with software. This - // software consists of a number of software by other authors. - // For example, for this project we use language tools by Apache, - // password complexity analysis, and several others. Each one of - // these might have security bugs - and if they have a security - // bug, so do we! - // - // DependencyCheck looks at the list of known - // security vulnerabilities from the United States National Institute of - // Standards and Technology (NIST), and checks if the software - // we are importing has any major known vulnerabilities. If so, - // the build will halt at this point. stage('Security: Dependency Analysis') { steps { - sh './gradlew dependencyCheckAnalyze' + sh './gradlew dependencyCheckAnalyze' } } - // Run Jmeter performance testing https://jmeter.apache.org/ - // This test simulates 50 users concurrently using our software - // for a set of common tasks. stage('Performance Tests') { steps { - sh './gradlew runPerfTests' + sh './gradlew runPerfTests' } } - // Runs mutation testing against some subset of our software - // as a spot test. Mutation testing is where bugs are seeded - // into the software and the tests are run, and we see which - // tests fail and which pass, as a result. - // - // what *should* happen is that where code or tests are altered, - // the test should fail, shouldn't it? However, it sometimes - // happens that no matter how code is changed, the tests - // continue to pass, which implies that the test wasn't really - // providing any value for those lines. stage('Mutation Tests') { steps { - sh './gradlew pitest' + sh './gradlew pitest' } } stage('Build Documentation') { steps { - sh './gradlew javadoc' + sh './gradlew javadoc' } } @@ -202,18 +139,12 @@ pipeline { } } - - // This is the stage where we deploy to production. If any test - // fails, we won't get here. Note that we aren't really doing anything - this - // is a token step, to indicate whether we would have deployed or not. Nothing actually - // happens, since this is a demo project. stage('Deploy to Prod') { steps { - // just a token operation while we pretend to deploy sh 'sleep 5' } } - } + } -} +} From 8384634a83923615070cb1b98d1dce2b222da561 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 06:19:29 +0000 Subject: [PATCH 32/47] fixed the jenkins file --- jenkins/Jenkinsfile | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 53645e5fc..52586377b 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -9,12 +9,6 @@ pipeline { stages { - stage('Container Build') { - steps { - sh 'docker build -t ensf400-demo .' - } - } - stage('Build') { environment { JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' @@ -145,6 +139,5 @@ pipeline { } } - } - -} + } +} From eff6909627f2d659a5a077abf45e01f1fae46933 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 16:49:09 +0000 Subject: [PATCH 33/47] fixed the static analysis part --- jenkins/Jenkinsfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 52586377b..768f502e0 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -55,7 +55,13 @@ pipeline { PATH = "${JAVA_HOME}/bin:${PATH}" } steps { - sh './gradlew sonarqube -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login="admin" -Dsonar.password="ensf400"' + withCredentials([string(credentialsId: 'GitHub-pa', variable: 'SONAR_TOKEN')]) { + sh ''' + ./gradlew sonarqube \ + -Dsonar.host.url=http://sonarqube:9000 \ + -Dsonar.login=$SONAR_TOKEN + ''' + } } } From 114c407689c25c5c2a59b0ae9b31462162a216b0 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 11:21:24 -0600 Subject: [PATCH 34/47] Update docker-compose.yaml --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index b09d42545..e9c8523be 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,7 +8,7 @@ services: - 50000:50000 container_name: jenkins volumes: - - /home/codespace:/var/jenkins_home + - jenkins_home:/var/jenkins_home - /var/run/docker.sock:/var/run/docker.sock networks: - dev-network From 7d2b6f3e2a37037fe7f358271f57cde816008b05 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 12:11:22 -0600 Subject: [PATCH 35/47] Update Jenkinsfile --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 768f502e0..175a15139 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -55,7 +55,7 @@ pipeline { PATH = "${JAVA_HOME}/bin:${PATH}" } steps { - withCredentials([string(credentialsId: 'GitHub-pa', variable: 'SONAR_TOKEN')]) { + withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) { sh ''' ./gradlew sonarqube \ -Dsonar.host.url=http://sonarqube:9000 \ From 3a6c4042799100d57d2723fc3aaf87df181dfa82 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 13:11:29 -0600 Subject: [PATCH 36/47] Update Jenkinsfile --- jenkins/Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 175a15139..cd9204249 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -55,11 +55,12 @@ pipeline { PATH = "${JAVA_HOME}/bin:${PATH}" } steps { - withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) { + withCredentials([string(credentialsId: 'sonar_token', variable: 'SONAR_TOKEN')]) { sh ''' ./gradlew sonarqube \ -Dsonar.host.url=http://sonarqube:9000 \ - -Dsonar.login=$SONAR_TOKEN + -Dsonar.login=$SONAR_TOKEN \ + -Dsonar.projectKey=ensf_project ''' } } From 7080becb0bf76d639c1ce7762c11ca3e6c05a6b8 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 13:32:39 -0600 Subject: [PATCH 37/47] Update Jenkinsfile --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index cd9204249..0876ecd2c 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -55,7 +55,7 @@ pipeline { PATH = "${JAVA_HOME}/bin:${PATH}" } steps { - withCredentials([string(credentialsId: 'sonar_token', variable: 'SONAR_TOKEN')]) { + withCredentials([string(credentialsId: 'sonarl', variable: 'SONAR_TOKEN')]) { sh ''' ./gradlew sonarqube \ -Dsonar.host.url=http://sonarqube:9000 \ From de285640aebf040c06b542c8bd7553b2110d5ebe Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 13:41:05 -0600 Subject: [PATCH 38/47] Update Jenkinsfile --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 0876ecd2c..4e1bdffcc 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -58,7 +58,7 @@ pipeline { withCredentials([string(credentialsId: 'sonarl', variable: 'SONAR_TOKEN')]) { sh ''' ./gradlew sonarqube \ - -Dsonar.host.url=http://sonarqube:9000 \ + -Dsonar.host.url=https://opulent-succotash-x5v565xrx4wrc645p-9000.app.github.dev \ -Dsonar.login=$SONAR_TOKEN \ -Dsonar.projectKey=ensf_project ''' From d1bb57bb3d56bdbb49d32bebebd06f14403f2f7d Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Mon, 14 Apr 2025 02:15:09 +0000 Subject: [PATCH 39/47] testing the trigger --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index 04f1299db..d87948e22 100644 --- a/README(2).md +++ b/README(2).md @@ -70,7 +70,7 @@ To containerize our application, we use Docker and Docker Hub. After creating an To deploy the application, we pull the Docker image from Docker Hub using the command docker pull natnaelt2/ensf400-demo:commit-hash. Finally, we run the Docker container using the command docker run -p 8080:8080 natnaelt2/ensf400-demo:commit-hash. Then visit the application with your browser at http://localhost:8080/demo. ## Jenkins -Creating branch to trigger jenkins with public port again +Creating branch to trigger jenkins with public From 9e8cb3f177c0c055b12f8ad0d57ca524be4aee2b Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 20:39:59 -0600 Subject: [PATCH 40/47] Update Jenkinsfile --- jenkins/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 4e1bdffcc..e6945bdcd 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -55,10 +55,10 @@ pipeline { PATH = "${JAVA_HOME}/bin:${PATH}" } steps { - withCredentials([string(credentialsId: 'sonarl', variable: 'SONAR_TOKEN')]) { + withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) { sh ''' ./gradlew sonarqube \ - -Dsonar.host.url=https://opulent-succotash-x5v565xrx4wrc645p-9000.app.github.dev \ + -Dsonar.host.url=http://sonarqube:9000 \ -Dsonar.login=$SONAR_TOKEN \ -Dsonar.projectKey=ensf_project ''' From eaaf0080e6b3da5cd5b91c6a9836816862408f99 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 20:49:11 -0600 Subject: [PATCH 41/47] Update Jenkinsfile --- jenkins/Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index e6945bdcd..175a15139 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -59,8 +59,7 @@ pipeline { sh ''' ./gradlew sonarqube \ -Dsonar.host.url=http://sonarqube:9000 \ - -Dsonar.login=$SONAR_TOKEN \ - -Dsonar.projectKey=ensf_project + -Dsonar.login=$SONAR_TOKEN ''' } } From 4b14018a5aef83279c82509b2bb3fc88dc156cd9 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 20:53:04 -0600 Subject: [PATCH 42/47] Update Jenkinsfile --- jenkins/Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 175a15139..2c507b6c8 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -59,7 +59,8 @@ pipeline { sh ''' ./gradlew sonarqube \ -Dsonar.host.url=http://sonarqube:9000 \ - -Dsonar.login=$SONAR_TOKEN + -Dsonar.login=admin \ + -Dsonar.password=manutd ''' } } From 394b93f24444117a2ad61246594f2bd10c92f55e Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 21:27:24 -0600 Subject: [PATCH 43/47] Update Jenkinsfile --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 2c507b6c8..062ed802d 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { environment { HTTP_PROXY = 'http://127.0.0.1:9888' - JAVA_HOME = '/usr/lib/jvm/java-17-openjdk' + JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' PATH = "${JAVA_HOME}/bin:${PATH}" } From 31f91bba8f4e1608ddc4ab96d4e73309a5316b8a Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 21:34:20 -0600 Subject: [PATCH 44/47] Update Dockerfile --- jenkins/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jenkins/Dockerfile b/jenkins/Dockerfile index 92ab42046..fe6012171 100644 --- a/jenkins/Dockerfile +++ b/jenkins/Dockerfile @@ -8,7 +8,9 @@ RUN apk add --no-cache \ bash \ docker \ curl \ - unzip + unzip \ + py3-pip && \ + pip3 install pipenv ENV GRADLE_VERSION=7.6 ENV GRADLE_HOME=/opt/gradle @@ -18,4 +20,4 @@ RUN mkdir -p ${GRADLE_HOME} && \ rm /tmp/gradle.zip ENV PATH="${GRADLE_HOME}/gradle-${GRADLE_VERSION}/bin:${PATH}" -RUN gradle -v \ No newline at end of file +RUN gradle -v From 1689f4da5a34854bb6742d99f4b30aee9de62e7a Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Sun, 13 Apr 2025 21:40:22 -0600 Subject: [PATCH 45/47] Update Dockerfile --- jenkins/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Dockerfile b/jenkins/Dockerfile index fe6012171..1a696d1df 100644 --- a/jenkins/Dockerfile +++ b/jenkins/Dockerfile @@ -10,7 +10,7 @@ RUN apk add --no-cache \ curl \ unzip \ py3-pip && \ - pip3 install pipenv + pip3 install --break-system-packages pipenv ENV GRADLE_VERSION=7.6 ENV GRADLE_HOME=/opt/gradle From 3e5998133548a249cfb30759b762896f1bf0d52e Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Mon, 14 Apr 2025 05:00:02 +0000 Subject: [PATCH 46/47] testing the jenkins webook --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index d87948e22..8165b0b4c 100644 --- a/README(2).md +++ b/README(2).md @@ -70,7 +70,7 @@ To containerize our application, we use Docker and Docker Hub. After creating an To deploy the application, we pull the Docker image from Docker Hub using the command docker pull natnaelt2/ensf400-demo:commit-hash. Finally, we run the Docker container using the command docker run -p 8080:8080 natnaelt2/ensf400-demo:commit-hash. Then visit the application with your browser at http://localhost:8080/demo. ## Jenkins -Creating branch to trigger jenkins with public + From 68132dc1188e2841e74e9a7e09b65b1d243e56d8 Mon Sep 17 00:00:00 2001 From: NatnaelTekli Date: Mon, 14 Apr 2025 05:06:54 +0000 Subject: [PATCH 47/47] first test --- README(2).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README(2).md b/README(2).md index 8165b0b4c..ea69cbe99 100644 --- a/README(2).md +++ b/README(2).md @@ -71,7 +71,7 @@ To deploy the application, we pull the Docker image from Docker Hub using the co ## Jenkins - +we are testing the jenkins trigger