Skip to content

Commit

Permalink
initial commit with maven, artifcatory and jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
yankils committed May 16, 2020
1 parent 659b4f0 commit 465d9ff
Show file tree
Hide file tree
Showing 10 changed files with 237 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Setup_Artifactory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Setup Jfrog Artifactory

## Pre-requisites:
1. Setup an AWS T2.Small EC2 instance

## Installation Steps

1. Install Java
```sh
yum install java-1.8* -y
```
1. Download Artifaction packages from

```sh
wget https://bintray.com/jfrog/artifactory-pro/download_file?file_path=org%2Fartifactory%2Fpro%2Fjfrog-artifactory-pro%2F6.19.1%2Fjfrog-artifactory-pro-6.19.1.zip
```

1. extract artifactory zip file
```sh
unzip download_file?file_path=org%2Fartifactory%2Fpro%2Fjfrog-artifactory-pro%2F6.19.1%2Fjfrog-artifactory-pro-6.19.1.zip
```
1. start artifactory services
```sh
cd artifactory-pro-6.19.1/bin
./artifactory.sh start
```
1. access artifactory from browser
```sh
http://<IP_Address>:8081
```

1. Provide credentials
```sh
username: admin
password: passwrod
```

5 changes: 5 additions & 0 deletions jenkins/DSL_jobs/1job.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

job('job_dsl_example') {

}

5 changes: 5 additions & 0 deletions jenkins/DSL_jobs/2description.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

job('job_dsl_example') {

description('This is my awesome Job')
}
14 changes: 14 additions & 0 deletions jenkins/DSL_jobs/3parameters.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

job('job_dsl_example') {

description('This is my awesome Job')


parameters {
stringParam('Planet', defaultValue = 'world', description = 'This is the world')
booleanParam('FLAG', true)
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3'])
}

}

19 changes: 19 additions & 0 deletions jenkins/DSL_jobs/4scm.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

job('job_dsl_example') {

description('This is my awesome Job')


parameters {
stringParam('Planet', defaultValue = 'world', description = 'This is the world')
booleanParam('FLAG', true)
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3'])
}


scm {
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master')
}

}

22 changes: 22 additions & 0 deletions jenkins/DSL_jobs/5triggers.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

job('job_dsl_example') {

description('This is my awesome Job')


parameters {
stringParam('Planet', defaultValue = 'world', description = 'This is the world')
booleanParam('FLAG', true)
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3'])
}

scm {
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master')
}

triggers {
cron('H 5 * * 7')
}

}

25 changes: 25 additions & 0 deletions jenkins/DSL_jobs/6steps.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

job('job_dsl_example') {

description('This is my awesome Job')


parameters {
stringParam('Planet', defaultValue = 'world', description = 'This is the world')
booleanParam('FLAG', true)
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3'])
}

scm {
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master')
}

triggers {
cron('H 5 * * 7')
}

steps {
shell("echo 'Hello World'")
}
}

30 changes: 30 additions & 0 deletions jenkins/DSL_jobs/7mailer.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

job('job_dsl_example') {

description('This is my awesome Job')


parameters {
stringParam('Planet', defaultValue = 'world', description = 'This is the world')
booleanParam('FLAG', true)
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3'])
}

scm {
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master')
}

triggers {
cron('H 5 * * 7')
}

steps {
shell("echo 'Hello World'")
shell("echo 'Hello World2'")
}

publishers {
mailer('[email protected]', true, true)
}
}

30 changes: 30 additions & 0 deletions jenkins/DSL_jobs/8maven.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
job('maven_dsl') {

description('Maven dsl project')

scm {
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master', {node -> node / 'extensions' << '' })
}

steps {
maven {
mavenInstallation('maven')
goals('-B -DskipTests clean package')
}
maven {
mavenInstallation('maven')
goals('test')
}
shell('''
echo ************RUNNING THE JAR************************
java -jar /var/lib/jenkins/workspace/maven_dsl/target/my-app-1.0-SNAPSHOT.jar
''')
}

publishers {
archiveArtifacts('target/*.jar')
archiveJunit('target/surefire-reports/*.xml')
mailer('[email protected]', true, true)
}
}

50 changes: 50 additions & 0 deletions maven/How_to_deploy_warfile_on_tomcat_server_using_maven.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# How to deploy on tomcat server using maven
Pre-requisites
1. Maven Server [Get help here]
2. Tomcat Server [Get help here]

Procedure

1. download archetype maven-archetype-webapp
```sh
mvn archetype:generate -DgroupId=com.valaxy.webapp -DartifactId=helloworld-project -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
```

1. Update pom.xml code to add maven plugin to copy artifacts onto tomcat
this should be under <build>
```sh
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat8-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/helloworld-webapp</path>
</configuration>
</plugin>
</plugins>
```

1. create settings.xml for credentials
```sh
<?xml version="1.0" encoding="UTF-8"?>
<settings ...>
<servers>

<server>
<id>TomcatServer</id>
<username>admin</username>
<password>password</password>
</server>

</servers>
</settings>
```


1. Build and the project on tomcat
```sh
mvn tomcat7:deploy
```

0 comments on commit 465d9ff

Please sign in to comment.