Skip to content

Commit 1f96915

Browse files
committed
Ajuste scripts jenkins
1 parent 067d4a7 commit 1f96915

File tree

3 files changed

+311
-0
lines changed

3 files changed

+311
-0
lines changed

Dockerfile-build

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ARG mavenImage
2+
ARG mavenImageVersion
3+
FROM ${mavenImage}:${mavenImageVersion} as builder
4+
ARG nameSpace
5+
ARG DskipTests
6+
WORKDIR /app
7+
COPY . /app
8+
9+
RUN mvn package -s -f pom-base.xml -Dversao=$nameSpace $DskipTests
10+

jenkinsfile

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
podTemplate(
2+
name: 'build-services',
3+
namespace: 'jenkins ',
4+
label: 'build-services',
5+
containers:
6+
[containerTemplate(
7+
args: 'cat',
8+
command: '/bin/sh -c',
9+
image: 'baseerp/docker:1.4',
10+
livenessProbe: containerLivenessProbe(execArgs: '',
11+
failureThreshold: 0,
12+
initialDelaySeconds: 0,
13+
periodSeconds: 0,
14+
successThreshold: 0,
15+
timeoutSeconds: 0),
16+
name: 'docker-container',
17+
resourceLimitCpu: '',
18+
resourceLimitMemory: '',
19+
resourceRequestCpu: '',
20+
resourceRequestMemory: '',
21+
ttyEnabled: true,
22+
workingDir: '/home/jenkins/agent')
23+
],
24+
volumes: [hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')],
25+
nodeSelector: 'type=jenkins-worker',
26+
)
27+
{
28+
node('build-services') {
29+
echo '*********************************************************Parametros************************************************************************'
30+
echo '*******************************************************************************************************************************************'
31+
echo "Ambiente: ${Ambiente}"
32+
echo "Servicos: ${Servicos}"
33+
echo "Branch: ${Branch}"
34+
35+
echo '*******************************************************************************************************************************************'
36+
echo '*******************************************************************************************************************************************'
37+
38+
def gitRepos = ""
39+
def namespace = "${Ambiente}"
40+
def executarTestes = "${Testes}"
41+
def imagem_build = "baseerp/services-build"
42+
def versao = "1.0.${currentBuild.number}"
43+
def git_branch = ""
44+
def DskipTests = "-DskipTests"
45+
if (executarTestes.toLowerCase().equals("sim")) {
46+
DskipTests = ""
47+
}
48+
49+
stage('Checkout') {
50+
echo '*********************************************************Checkout************************************************************************'
51+
gitRepos = checkout scm
52+
git_branch = gitRepos.GIT_BRANCH
53+
versao = versao + '-' + namespace
54+
echo 'Repositório :' + gitRepos.toString()
55+
echo 'Branch :' + git_branch.toString()
56+
}
57+
58+
stage('Package') {
59+
container('docker-container') {
60+
echo '*********************************************************Package************************************************************************'
61+
withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'DOCKER_HUB_PASSWORD', usernameVariable: 'DOCKER_HUB_USER')]) {
62+
def mavenImage = "baseerp/maven-services"
63+
def mavenImageVersion = "1.3"
64+
sh label: '', script: "docker login -u ${DOCKER_HUB_USER} -p ${DOCKER_HUB_PASSWORD}"
65+
sh label: '', script: "docker build -f Dockerfile-build -t ${imagem_build}:${versao} . --build-arg mavenImage=${mavenImage} --build-arg mavenImageVersion=${mavenImageVersion} --build-arg nameSpace=${namespace} --build-arg DskipTests=${DskipTests} --network=host"
66+
}
67+
}
68+
}
69+
70+
}
71+
}

pom-base.xml

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>br.com.swconsultoria</groupId>
5+
<artifactId>java-nfe</artifactId>
6+
<version>4.00.18-SNAPSHOT</version>
7+
<name>Java_NFe</name>
8+
<description>Api java para consumo do webService de nota fiscal eletronica</description>
9+
<url>https://github.com/Samuel-Oliveira/Java_NFe</url>
10+
11+
<licenses>
12+
<license>
13+
<name>MIT License</name>
14+
<url>http://www.opensource.org/licenses/mit-license.php</url>
15+
<distribution>repo</distribution>
16+
</license>
17+
</licenses>
18+
19+
<scm>
20+
<url>[email protected]:Samuel-Oliveira/Java_NFe.git</url>
21+
<connection>scm:git:[email protected]:Samuel-Oliveira/Java_NFe.git</connection>
22+
<developerConnection>scm:git:[email protected]:Samuel-Oliveira/Java_NFe.git</developerConnection>
23+
<tag>java-nfe</tag>
24+
</scm>
25+
26+
<properties>
27+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
28+
<maven.javadoc.failOnError>false</maven.javadoc.failOnError>
29+
<maven.compiler.source>1.8</maven.compiler.source>
30+
<maven.compiler.target>1.8</maven.compiler.target>
31+
<java.version>1.8</java.version>
32+
</properties>
33+
34+
<distributionManagement>
35+
<snapshotRepository>
36+
<id>sonatype-nexus</id>
37+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
38+
</snapshotRepository>
39+
<repository>
40+
<id>sonatype-nexus</id>
41+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
42+
</repository>
43+
</distributionManagement>
44+
45+
<developers>
46+
<developer>
47+
<id>Samuel-Oliveira</id>
48+
<name>Samuel Borges de Oliveira</name>
49+
<url>https://github.com/Samuel-Oliveira</url>
50+
</developer>
51+
</developers>
52+
53+
<dependencies>
54+
<!-- Certificado Utils -->
55+
<dependency>
56+
<groupId>br.com.swconsultoria</groupId>
57+
<artifactId>java_certificado</artifactId>
58+
<version>2.8</version>
59+
</dependency>
60+
<!-- Ini4J -->
61+
<dependency>
62+
<groupId>org.ini4j</groupId>
63+
<artifactId>ini4j</artifactId>
64+
<version>0.5.4</version>
65+
</dependency>
66+
67+
<dependency>
68+
<groupId>org.apache.httpcomponents</groupId>
69+
<artifactId>httpcore</artifactId>
70+
<version>4.4.6</version>
71+
</dependency>
72+
73+
<!--Java 11-->
74+
<dependency>
75+
<groupId>com.sun.xml.bind</groupId>
76+
<artifactId>jaxb-impl</artifactId>
77+
<version>2.3.1</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>com.sun.xml.bind</groupId>
81+
<artifactId>jaxb-xjc</artifactId>
82+
<version>2.3.1</version>
83+
</dependency>
84+
<dependency>
85+
<groupId>com.sun.xml.bind</groupId>
86+
<artifactId>jaxb-core</artifactId>
87+
<version>2.3.0.1</version>
88+
</dependency>
89+
90+
<dependency>
91+
<groupId>org.apache.axis2</groupId>
92+
<artifactId>axis2-kernel</artifactId>
93+
<version>1.7.5</version>
94+
<exclusions>
95+
<exclusion>
96+
<artifactId>servlet-api</artifactId>
97+
<groupId>javax.servlet</groupId>
98+
</exclusion>
99+
<exclusion>
100+
<artifactId>commons-fileupload</artifactId>
101+
<groupId>commons-fileupload</groupId>
102+
</exclusion>
103+
</exclusions>
104+
</dependency>
105+
106+
<dependency>
107+
<groupId>org.apache.axis2</groupId>
108+
<artifactId>axis2-adb</artifactId>
109+
<version>1.7.5</version>
110+
</dependency>
111+
112+
<dependency>
113+
<groupId>org.apache.axis2</groupId>
114+
<artifactId>axis2-jaxws</artifactId>
115+
<version>1.7.5</version>
116+
</dependency>
117+
118+
<dependency>
119+
<groupId>org.apache.axis2</groupId>
120+
<artifactId>axis2-transport-http</artifactId>
121+
<version>1.7.5</version>
122+
</dependency>
123+
124+
<dependency>
125+
<groupId>org.apache.axis2</groupId>
126+
<artifactId>axis2-transport-local</artifactId>
127+
<version>1.7.5</version>
128+
</dependency>
129+
130+
<dependency>
131+
<groupId>org.apache.ws.commons.axiom</groupId>
132+
<artifactId>axiom-api</artifactId>
133+
<version>1.2.20</version>
134+
</dependency>
135+
<dependency>
136+
<groupId>org.jmockit</groupId>
137+
<artifactId>jmockit</artifactId>
138+
<version>1.46</version>
139+
<scope>test</scope>
140+
</dependency>
141+
<dependency>
142+
<groupId>org.junit.jupiter</groupId>
143+
<artifactId>junit-jupiter</artifactId>
144+
<version>5.4.0</version>
145+
<scope>test</scope>
146+
</dependency>
147+
<dependency>
148+
<groupId>org.projectlombok</groupId>
149+
<artifactId>lombok</artifactId>
150+
<version>1.18.22</version>
151+
<scope>provided</scope>
152+
</dependency>
153+
154+
</dependencies>
155+
156+
<build>
157+
<plugins>
158+
<plugin>
159+
<groupId>org.apache.maven.plugins</groupId>
160+
<artifactId>maven-compiler-plugin</artifactId>
161+
<version>3.8.0</version>
162+
<configuration>
163+
<source>1.8</source>
164+
<target>1.8</target>
165+
</configuration>
166+
</plugin>
167+
<plugin>
168+
<groupId>org.sonatype.plugins</groupId>
169+
<artifactId>nexus-staging-maven-plugin</artifactId>
170+
<version>1.6.8</version>
171+
<extensions>true</extensions>
172+
<configuration>
173+
<serverId>sonatype-nexus</serverId>
174+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
175+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
176+
</configuration>
177+
</plugin>
178+
<plugin>
179+
<groupId>org.apache.maven.plugins</groupId>
180+
<artifactId>maven-gpg-plugin</artifactId>
181+
<version>1.6</version>
182+
<executions>
183+
<execution>
184+
<id>sign-artifacts</id>
185+
<phase>verify</phase>
186+
<goals>
187+
<goal>sign</goal>
188+
</goals>
189+
</execution>
190+
</executions>
191+
</plugin>
192+
<plugin>
193+
<groupId>org.apache.maven.plugins</groupId>
194+
<artifactId>maven-release-plugin</artifactId>
195+
<version>2.5.3</version>
196+
<configuration>
197+
<pushChanges>false</pushChanges>
198+
<localCheckout>true</localCheckout>
199+
</configuration>
200+
</plugin>
201+
<plugin>
202+
<groupId>org.apache.maven.plugins</groupId>
203+
<artifactId>maven-assembly-plugin</artifactId>
204+
<version>2.4</version>
205+
<configuration>
206+
<descriptorRefs>
207+
<descriptorRef>jar-with-dependencies</descriptorRef>
208+
</descriptorRefs>
209+
</configuration>
210+
<executions>
211+
<execution>
212+
<phase>none</phase>
213+
<goals>
214+
<goal>single</goal>
215+
</goals>
216+
</execution>
217+
</executions>
218+
</plugin>
219+
<plugin>
220+
<artifactId>maven-surefire-plugin</artifactId>
221+
<version>2.22.2</version>
222+
<configuration>
223+
<argLine>
224+
-javaagent:src/test/resources/agent.jar
225+
</argLine>
226+
</configuration>
227+
</plugin>
228+
</plugins>
229+
</build>
230+
</project>

0 commit comments

Comments
 (0)