Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# Crash log files
crash.log



# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
# .tfvars files are managed as part of configuration and so should be included in
# version control.
Expand All @@ -27,3 +29,34 @@ override.tf.json

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Created by https://www.toptal.com/developers/gitignore/api/java
# Edit at https://www.toptal.com/developers/gitignore?templates=java

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

# End of https://www.toptal.com/developers/gitignore/api/java
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>my-app</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
Binary file added HelloWorld.class
Binary file not shown.
5 changes: 5 additions & 0 deletions HelloWorld.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World From Varun Manik");
}
}
87 changes: 5 additions & 82 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,10 @@
# Jenkins-cicd
PG DO - CI/CD Pipeline with Jenkins Simplilearn
# Java

# AWS Ubuntu VM Provisioning steps
- Step 1: Click on Launch Instance
- Step 2 : Click on Software Image (AMI)
- Select Ubuntu
- Step 4: Key pair name – required
- Click on Create new key pair
- Put key pair name Jenkins-sl
- & Download it
- Step 5 : Click on Launch Instance
- Step 6 : Select your VM and Click connect
- Step 7 : You can see the terminal
- Step: Showing Github example
## Build
## Simple Java command for linux terminal in Jenkins

# Git Status
```
git --version
```
## cretae Dir
```
mkdir demo
cd demo
```
## GIT & Ubuntu SSH connection
```
ssh-keygen

"Hit enter button 3 time"

cat ~/.ssh/id_rsa.pub
git clone git@github.com:manikcloud/Jenkins-cicd.git
history
history | cut -c 8-
```

# JENKINS INSTALLATION on UBUNTU 18.04, for Ubunt 22.04 please skip the step 3 & 4
```
sudo apt-get update
sudo apt install openjdk-8-jdk
sudo wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt install jenkins
sudo /etc/init.d/jenkins start
service jenkins status
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
history | cut -c 8-

```
# Jenkins URL with port 8080
- http://x.x.x.x:8080/

replace x with your ip
javac HelloWorld.java

# Change Security group rule for Jenkins
java HelloWorld
```
- Select your instance
- Down below select your security tab
- Click on the Security groups sg-0c51908b5fa4abf75 (launch-wizard-2)
- Click on the action
- Click on EDIT INBOUND RULE
- Select custom TCP and put port 8080
- Custom ip should be 0.0.0.0/0
- Click on Save the rule
```

# common error

```
getting "E: Unable to locate package openjdk-8-jdk" message on java update
```

# Resolution
Run this command

```
sudo apt update
```
# Plugin Installation
dashboard>manage>jenkins>manage plugins>maven integration


# References:
1. https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
2. https://maven.apache.org/download.cgi
201 changes: 31 additions & 170 deletions history.txt
Original file line number Diff line number Diff line change
@@ -1,170 +1,31 @@
1 clear
2 pwd
3 apt udate
4 apt update
5 sudo apt update
6 cat /etc/os-release
7 ping fb.com
8 mkdir demom
9 mkdir demo
10 cd demo
11 git
12 git -version
13 git --version
14 ls -a
15 ll -a
16 git init
17 ll -a
18 git status
19 vim index.html
20 git status
21 git add .
22 git status
23 git commit -am"first file"
24 git status
25 git log
26 vim index.html
27 cat index.html
28 git status
29 git add .
30 git status
31 git commit -am"first file 1"
32 git log
33 cd ..
34 ssh-keygen
35 cd ~/.ssh/
36 ll
37 cat id_rsa.pub
38 cd -
39 git clone git@github.com:manikcloud/Jenkins-cicd.git
40 cat ~/.ssh/id_rsa.pub
41 git clone git@github.com:manikcloud/Jenkins-cicd.git
42 history
43 history | cut -c 8-
44 cd Jenkins-cicd/
45 vim README.md
46 nano README.md
47 git status
48 git add . && git commit -am"adding readme" && git push
49 nano README.md
50 git add . && git commit -am"adding readme" && git push
51 ll ~/.ssh/
52 cat ~/.ssh/id_rsa.pub
53 ssh-keygen
54 ll ~/.ssh/
55 ll
56 rm varun *
57 rm varun*
58 ll
59 git pull
60 git status
61 git rm .
62 git status
63 git rm README.md
64 git status
65 git rm pom.xml
66 ll
67 git status
68 git restore --staged pom.xml
69 ll
70 cd ..
71 rm -rf Jenkins-cicd/
72 git clone git@github.com:manikcloud/Jenkins-cicd.git
73 cd Jenkins-cicd/
74 ll
75 vi index.html
76 git staus
77 git status
78 git add .
79 git status
80 git commit -am"adding index.html"
81 git push
82 vi README.md
83 git pull
84 vi README.md
85 sudo apt install openjdk-8-jdk
86 sudo wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add
87 sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
88 sudo apt-get update
89 sudo apt install jenkins
90 sudo /etc/init.d/jenkins start
91 service jenkins stgatus
92 service jenkins status
93 cat /var/lib/jenkins/secrets/initialAdminPassword
94 sudo cat /var/lib/jenkins/secrets/initialAdminPassword
95 history | cut -c 8-
96 cd Jenkins-cicd/
97 vi README.md
98 git add . && git commit -am"adding jenkins installtion step in readme" && git push
99 vi README.md
100 git add . && git commit -am"adding jenkins installtion step in readme" && git push
101 git pull
102 vi README.md
103 ll -a
104 rm .README.md.swp
105 ll -a
106 vim README.md
107 git add . && git commit -am"adding jenkins installtion step in readme" && git push
108 vim README.md
109 git add . && git commit -am"adding jenkins installtion step in readme" && git push
110 sudo cat /var/lib/jenkins/secrets/initialAdminPassword
111 echo "varun"
112 vim README.md
113 git add . && git commit -am"adding jenkins installtion step in readme" && git push
114 git config --global --edit
115 git add . && git commit -am"adding jenkins installtion step in readme" && git push
116 git push
117 git pull
118 vim README.md
119 git add . && git commit -am"adding jenkins installtion step in readme" && git push
120 git pull
121 vim README.md
122 mvn --version
123 sudo apt install maven
124 apt install tree
125 sudo apt install tree
126 which mvn
127 mvn --version
128 cd ..
129 mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
130 ll
131 rm -rf my-app/
132 ll
133 mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
134 ll
135 cd my-app/
136 ll
137 tree
138 mvn ppackage
139 mvn package
140 ll
141 tree
142 ll
143 ll target/
144 java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
145 vim src/main/java/com/mycompany/app/App.java
146 java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
147 mvn clean install
148 java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
149 cd ..
150 ll
151 rm -rf Jenkins-cicd/
152 git clone git@github.com:manikcloud/Jenkins-cicd.git
153 cd Jenkins-cicd/
154 ll
155 whereis mvn
156 cd ..
157 wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
158 ll
159 tar -xvzf apache-maven-3.8.6-bin.tar.gz
160 ll
161 cd apache-maven-3.8.6/
162 ll
163 pwd
164 whereis java
165 whereis git
166 which git
167 which mvn
168 pwd
169 ll
170 history > ../Jenkins-cicd/history.txt
1. JENKINS installation
2. git integation with Jenkins
3. java integration with Jenkins



git clone https://github.com/manikcloud/Jenkins-cicd.git
cd Jenkins-cicd/
ll
git switch create_ec2_tf
chmod 755 jenkins-installation-ubuntu.sh
sh jenkins-installation-ubuntu.sh

cat jenkins-installation-ubuntu.sh
sudo cat /var/lib/jenkins/secrets/initialAdminPassword


sudo apt install maven
mvn --version
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
sudo apt install tree -y

cd my-app/

tree
mvn install

tree
java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App

history | cut -c 8-
1 change: 0 additions & 1 deletion index.html

This file was deleted.

Loading