exp 4

 sudo apt update

sudo apt upgrade -y


sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc \

  https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key


echo "deb [signed-by=/etc/apt/keyrings/jenkins-keyring.asc]" \

  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \

  /etc/apt/sources.list.d/jenkins.list > /dev/null


Maven Project: https://github.com/devops-ds/your-maven-project.git

#Gradle Project: https://github.com/devops-ds/your-gradle-project.git

sudo apt update

sudo apt install jenkins -y

sudo systemctl start jenkins

sudo systemctl enable jenkins

sudo systemctl status jenkins


# in web browser login to jenkin with the administrator credentials you created during the initial setup.

#On the Jenkins dashboard, click "New Item" (or "Create a job" if it's a fresh installation).
#Enter an item name (e.g., Maven-GitHub-Freestyle or Gradle-GitHub-Freestyle).
#Select "Freestyle project".
#Click "OK".

/ * In the job configuration page for your Freestyle project:

  1. Scroll down to the "Source Code Management" section.
  2. Select "Git".
  3. In the "Repository URL" field, enter the URL for your chosen GitHub repository (either one of the examples provided or your own).
    • For Maven: https://github.com/devops-ds/your-maven-project.git
    • For Gradle: https://github.com/devops-ds/your-gradle-project.git
  4. If you are using your own private repository, you will need to add credentials. Click "Add" next to "Credentials" and provide your GitHub username and password or a personal access token. If using the provided public repositories, no credentials are needed.
  5. Under "Branches to build", ensure */main is specified. If your repository uses a different default branch (like */master), adjust this accordingly. For the provided public repositories, */main is correct
*/


/*
  • If you are building a Maven Project:
    1. Scroll down to the "Build" section.

    2. Click "Add build step".

    3. Select "Execute shell" (or "Execute Windows batch command" on Windows).

    4. In the "Command" area, enter the full path to your Maven executable followed by the goals you want to run (e.g., clean install).

      To find the full path to your mvn executable on open terminal in Ubuntu and run:

*/

which mvn

sudo cat /var/lib/jenkins/secrets/initialAdminPassword # terminal

#/path/to/your/maven/bin/mvn clean install

# Example:

/usr/bin/mvn clean install










Comments

Popular posts from this blog

pom.xml

exp 6

exp 5