Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
04fef5a
se agrega jenkins file
darobles Nov 7, 2022
98a2e12
prueba de jenkins
darobles Nov 7, 2022
c191bcd
add member
krostyle Nov 7, 2022
d87a055
Merge pull request #1 from ceres-grupo-7/feature/test-readme
Fahren82 Nov 7, 2022
99e4d4d
Update Jenkinsfile
darobles Nov 9, 2022
354b77a
Update README.md
darobles Nov 9, 2022
3045c19
Update Jenkinsfile
darobles Nov 9, 2022
3d79f5c
Update README.md
darobles Nov 9, 2022
5a5cdd8
test jenkins
darobles Nov 9, 2022
068def0
test jenkins pipeline
darobles Nov 9, 2022
6ad88a6
Update Jenkinsfile
darobles Nov 9, 2022
0c96480
Update Jenkinsfile
darobles Nov 9, 2022
8a4a70f
Update Jenkinsfile
darobles Nov 9, 2022
fbaeb3e
Update Jenkinsfile
darobles Nov 9, 2022
45ec360
estado-pais
yrma2102 Nov 9, 2022
4fe41dd
Merge pull request #2 from ceres-grupo-7/feature/estado-pais
danmoralesletelier Nov 9, 2022
8fc3949
Sube feature estado-mundial
danmoralesletelier Nov 9, 2022
0a7fbb2
Update RestData.java
darobles Nov 9, 2022
1a7c5b6
Agrega codigo con error
danmoralesletelier Nov 9, 2022
d716899
Merge pull request #3 from ceres-grupo-7/feature/estado-mundial
danmoralesletelier Nov 9, 2022
c5f0f67
Create maven-publish.yml
darobles Nov 11, 2022
ca29d15
Update maven-publish.yml
darobles Nov 11, 2022
cdd34b0
Update maven-publish.yml
darobles Nov 11, 2022
4940393
Update maven-publish.yml
darobles Nov 11, 2022
db28a7c
Update maven-publish.yml
darobles Nov 11, 2022
5e4fccc
Update maven-publish.yml
darobles Nov 11, 2022
b864c7e
Update maven-publish.yml
darobles Nov 11, 2022
3d9dd33
Update maven-publish.yml
darobles Nov 11, 2022
243463f
Update maven-publish.yml
darobles Nov 11, 2022
8086269
Update maven-publish.yml
darobles Nov 11, 2022
c917bf3
Update maven-publish.yml
darobles Nov 11, 2022
f858f58
Update maven-publish.yml
darobles Nov 11, 2022
c466861
Update maven-publish.yml
darobles Nov 11, 2022
4781612
Update maven-publish.yml
darobles Nov 11, 2022
55f3291
Update maven-publish.yml
darobles Nov 11, 2022
8423898
Update maven-publish.yml
darobles Nov 11, 2022
9cc6556
Update README.md
darobles Nov 11, 2022
af795af
Update maven-publish.yml
darobles Nov 11, 2022
54303b9
nueva feature
Nov 25, 2022
fb26abf
Merge pull request #4 from ceres-grupo-7/feature/featureRest
darobles Nov 25, 2022
ea6b5e8
Merge tag '1.0' into develop
Nov 25, 2022
23991ee
Merge branch 'release/1.1'
Nov 25, 2022
8227562
Merge tag '1.1' into develop
Nov 25, 2022
7dbb23a
Update Jenkinsfile
darobles Nov 25, 2022
7da8cba
Merge pull request #5 from ceres-grupo-7/release/1.2
darobles Nov 25, 2022
8ef650b
Update Jenkinsfile
darobles Nov 25, 2022
fb2b361
Merge branch 'release/v1.0.1'
darobles Nov 29, 2022
ba6e3ca
Merge tag 'v1.0.1' into develop
darobles Nov 29, 2022
20c2d3c
Merge branch 'release/v1.0.2'
darobles Nov 29, 2022
fcaa109
Merge tag 'v1.0.2' into develop
darobles Nov 29, 2022
efd5ae0
Merge branch 'release/v1.0.3'
darobles Nov 29, 2022
973c2f7
Merge tag 'v1.0.3' into develop
darobles Nov 29, 2022
6f47dfd
Merge branch 'release/v1.0.4'
darobles Nov 29, 2022
5098a65
Merge tag 'v1.0.4' into develop
darobles Nov 29, 2022
2b33335
Merge branch 'release/v1.0.5'
darobles Nov 29, 2022
1f634cf
Merge tag 'v1.0.5' into develop
darobles Nov 29, 2022
c7b0101
Update Jenkinsfile
darobles Nov 29, 2022
a5cc51d
asd
darobles Nov 30, 2022
7fabe22
jenkisfile
yrma2102 Nov 30, 2022
2d6c73d
jenkisfile
yrma2102 Nov 30, 2022
a2753f5
Merge branch 'release/v1.0.1'
yrma2102 Nov 30, 2022
e677ae8
git flow steps
yrma2102 Nov 30, 2022
c750692
Update Jenkinsfile
yrma2102 Nov 30, 2022
1392370
Update Jenkinsfile
darobles Nov 30, 2022
f1b3ac1
Merge branch 'release/v1.0.2'
yrma2102 Nov 30, 2022
4dfe80c
Update Jenkinsfile
darobles Dec 1, 2022
d27abcd
Merge pull request #8 from ceres-grupo-7/main
darobles Dec 1, 2022
0a7109e
Update Jenkinsfile
darobles Dec 1, 2022
fe935f8
Update Jenkinsfile
darobles Dec 1, 2022
291e91e
Update Jenkinsfile
darobles Dec 1, 2022
ef671c2
Update Jenkinsfile
darobles Dec 1, 2022
f128ec0
Update Jenkinsfile
darobles Dec 1, 2022
199fc34
Update Jenkinsfile
darobles Dec 1, 2022
c1a2e40
Update Jenkinsfile
darobles Dec 2, 2022
d2bded1
Update Jenkinsfile
darobles Dec 2, 2022
2221516
Merge pull request #9 from ceres-grupo-7/main
darobles Dec 2, 2022
4c67185
Update Jenkinsfile
darobles Dec 2, 2022
d50bd4b
Update Jenkinsfile
darobles Dec 2, 2022
93a4b23
Update Jenkinsfile
darobles Dec 2, 2022
b6e7e53
Update Jenkinsfile
darobles Dec 2, 2022
2eaac8f
Update Jenkinsfile
darobles Dec 2, 2022
ddfc2f6
Update Jenkinsfile
darobles Dec 2, 2022
b6bdd7c
Update Jenkinsfile
darobles Dec 2, 2022
f27bbb7
Update Jenkinsfile
darobles Dec 2, 2022
7a247b4
Update Jenkinsfile
darobles Dec 2, 2022
a521c4b
Update Jenkinsfile
darobles Dec 2, 2022
331e6a3
Update Jenkinsfile
darobles Dec 2, 2022
76663b0
Update Jenkinsfile
darobles Dec 2, 2022
488407a
Update Jenkinsfile
darobles Dec 2, 2022
20e0c3c
Update Jenkinsfile
darobles Dec 2, 2022
7fd4224
Update Jenkinsfile
darobles Dec 2, 2022
df4ef7e
Update Jenkinsfile
darobles Dec 2, 2022
d80debb
Update Jenkinsfile
darobles Dec 2, 2022
b5dad58
Update Jenkinsfile
darobles Dec 2, 2022
2221aa2
Merge branch 'main' into release/v1.0.5
darobles Dec 2, 2022
d551c27
Merge pull request #10 from ceres-grupo-7/release/v1.0.5
darobles Dec 2, 2022
3de6411
Merge pull request #11 from ceres-grupo-7/release/v1.0.5
darobles Dec 2, 2022
1a25dc5
Update Jenkinsfile
darobles Dec 2, 2022
e88629e
Merge branch 'release/v1.0.5'
yrma2102 Dec 2, 2022
7d226ae
Merge branch 'release/v1.0.5' into develop
yrma2102 Dec 2, 2022
87f633d
Update Jenkinsfile
darobles Dec 2, 2022
1fecca3
Merge branch 'main' of https://github.com/ceres-grupo-7/ms-iclab into…
Dec 2, 2022
dbd27b8
Update Jenkinsfile
darobles Dec 2, 2022
dfec812
Merge branch 'main' of https://github.com/ceres-grupo-7/ms-iclab into…
Dec 2, 2022
99b83a8
New version
Dec 2, 2022
9ea10ea
merged
darobles Dec 17, 2022
6fd78c3
funcion ValidaAPICOVID
darobles Dec 17, 2022
d7f0dfa
Merge branch 'feature/ValidaAPICovid' into develop
darobles Dec 17, 2022
9b23c28
Update Jenkinsfile
darobles Dec 17, 2022
2c3d07b
new changes
darobles Dec 17, 2022
e00de85
test estado mundial
darobles Dec 17, 2022
f0b79d3
Merge branch 'feature/estadoMundialTest'
yrma2102 Dec 17, 2022
2ac9c51
corregido jenkins file
darobles Dec 17, 2022
09bdcb7
corregido jenkins file
darobles Dec 17, 2022
ae861d9
Update Jenkinsfile
darobles Dec 17, 2022
1df28fb
Update Jenkinsfile
darobles Dec 17, 2022
f1dc19b
Update Jenkinsfile
darobles Dec 17, 2022
8a19c46
estadopais
danmoralesletelier Dec 17, 2022
e851df5
Update Jenkinsfile
darobles Dec 17, 2022
aec43a8
Merge branch 'release/v1.0.9'
darobles Dec 18, 2022
640d118
Merge tag 'v1.0.9' into develop
darobles Dec 18, 2022
5bd8346
added postman test for pipeline
darobles Dec 18, 2022
0890052
Add files via upload
darobles Dec 18, 2022
3150192
Update test_api_covid.postman_collection.json
darobles Dec 18, 2022
0712999
Update test_api_covid.postman_collection.json
darobles Dec 18, 2022
26a7675
fixed test postman
darobles Dec 18, 2022
f61c820
added curl to methods
darobles Dec 18, 2022
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
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/java
{
"name": "Java",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/java:0-17",

"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installMaven": "true",
"installGradle": "false"
}
}

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
50 changes: 50 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Java CI G7

on:
push:
branches: [ main ]

jobs:
build:
environment: env
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Deploy
run: mvn -B package --file pom.xml
- name: Upload application
uses: appleboy/scp-action@master
with:
host: drobles.cl
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
source: "/home/runner/work/ms-iclab/ms-iclab/build/DevOpsUsach2020-0.0.1.jar"
target: "/home/ec2-user/"
- name: Start Service DevOpsUsach2020
uses: appleboy/ssh-action@master
with:
host: drobles.cl
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
mv /home/ec2-user/devops.jar /home/ec2-user/devops-old.jar || true
mv /home/ec2-user/github/workspace/build/DevOpsUsach2020-0.0.1.jar /home/ec2-user/devops.jar
killall java
java -jar /home/ec2-user/devops.jar >> /dev/null &
- name: Sleep for 10 seconds
uses: jakejarvis/wait-action@master
with:
time: '10s'
- name: Test url using Curl
run: curl -X GET 'http://grupo7.drobles.cl/rest/mscovid/estadoPais?pais=chile'
shell: bash

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.compile.nullAnalysis.mode": "automatic"
}
298 changes: 298 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
import groovy.json.JsonSlurperClassic
import hudson.Util;
def jsonParse(def json) {
new groovy.json.JsonSlurperClassic().parseText(json)
}
def current_stage
def build_duration_msg = "\n *Detail by Stage* \n"
pipeline {
agent any
environment {
GITHUB_EMAIL = credentials('GITHUB_EMAIL')
GITHUB_USERNAME = credentials('GITHUB_USERNAME')
GRUPO_CHANNEL = 'D045253KTEZ'
NOMBRE_GRUPO = 'Grupo 7'
}
stages {
stage("Paso 1: Compilar"){
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 1: Compiling code!'"
sh "./mvnw clean compile -e"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage("Paso 2: Testear"){
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 2: Testing code!'"
sh "./mvnw clean test -e"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage("Paso 3: Build .Jar"){
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 3: Building .Jar file!'"
sh "./mvnw clean package -e"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage("Paso 4: Run .Jar"){
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 4: Running .Jar file!'"
sh "nohup bash ./mvnw spring-boot:run & >/dev/null"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage("Paso 5: Testing deploy"){
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 5: Testing deploy!'"
sh "sleep 20"
sh "curl -X GET 'http://localhost:8081/rest/mscovid/estadoPais?pais=Chile'"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage("Paso 6: Running postman tests"){
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 6: Testing deploy!'"
sh "newman run test_api_covid.postman_collection.json"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage("Paso 7: stop Testing deploy"){
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 7: Stopping jar running'"
sh "sleep 10"
sh '''kill -9 $(pidof java | awk '{print $1}')'''
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage("Paso 8: Analizar en Sonar"){
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
withSonarQubeEnv('sonarqube') {
sh "echo 'Stage 8: Static code analysis in Sonar'"
sh 'sh mvnw clean verify sonar:sonar -Dsonar.projectKey=com.devopsusach2020:DevOpsUsach2020'
}
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage("Paso 9: Release Subir Artefacto a Nexus"){
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 9:Uploading artifact to Nexus'"
MY_VERSION = env.BRANCH_NAME.substring(8)
nexusPublisher nexusInstanceId: 'maven-ceres-repository',
nexusRepositoryId: 'maven-usach-ceres',
packages: [
[$class: 'MavenPackage',
mavenAssetList: [
[classifier: '',
extension: 'jar',
filePath: 'build/DevOpsUsach2020-0.0.1.jar'
]
],
mavenCoordinate: [
artifactId: 'DevOpsUsach2020',
groupId: 'com.devopsusach2020',
packaging: 'jar',
version: MY_VERSION
]
]
]
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage('Paso 10: Descargar ultima version jar de Nexus') {
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 10:Downloading artifact from Nexus'"
MY_VERSION = env.BRANCH_NAME.substring(8)
MY_EXTENSION = ".jar"
sh "curl -X GET 'http://nexus:8081/repository/maven-usach-ceres/com/devopsusach2020/DevOpsUsach2020/$MY_VERSION/DevOpsUsach2020-$MY_VERSION$MY_EXTENSION' -O"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage('Paso 11: Levantar y testear Artefacto Jar obtenido de nexus') {
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 11:Testing artifact downloaded from Nexus'"
sh "nohup java -jar DevOpsUsach2020-$MY_VERSION$MY_EXTENSION & >/dev/null"
sh "sleep 20 && curl -X GET 'http://jenkins:8081/rest/mscovid/estadoPais?pais=ecuador'"
sh "sleep 20 && curl -X GET 'http://jenkins:8081/rest/mscovid/estadoMundial'"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage('Paso 12:Detener Atefacto jar en Jenkins server') {
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 12: Stopping artifact'"
sh "sleep 10"
sh '''kill -9 $(pidof java | awk '{print $1}')'''
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage('Paso 13: Desplegar en Produccion') {
when { anyOf { branch 'release/*' } }
steps {
script {
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 13: Deploying on production'"
sh "echo 'enviado a produccion $MY_VERSION'"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}
}
}
stage('Paso 14: Merge y Tag en Github') {
when { anyOf { branch 'release/*' } }
steps {
withCredentials([
gitUsernamePassword(credentialsId: 'github-jenkins', gitToolName: 'Default')
]) {
script{
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 14: Merging branch release on main and develop and create tag'"
//Release branch has been merged into '$GITHUB_EMAIL'
sh "git config --global user.email '$GITHUB_EMAIL'"
sh "git config --global user.name '$GITHUB_USERNAME'"
sh "git checkout ${env.BRANCH_NAME}"
sh "git pull origin"

sh "git checkout main"
sh "git fetch origin"
sh "git pull origin main"
sh "git merge ${env.BRANCH_NAME}"
sh "git push origin main"

//traer el ultimo tag del origin
MY_VERSION_TAG = sh(returnStdout: true, script: 'git tag --sort=-creatordate | head -n 1').trim()
if (MY_VERSION_TAG == MY_VERSION) {
sh "git tag -d ${MY_VERSION}"
sh "git push --delete origin ${MY_VERSION}"
sh "git tag -a $MY_VERSION -m 'update release from Jenkins'"
sh "git push origin $MY_VERSION"
} else {
sh "git tag -a $MY_VERSION -m 'update release from Jenkins'"
sh "git push origin $MY_VERSION"
}

//Release tag has been back-merged into 'develop'
sh "git checkout develop"
sh "git pull origin develop"
sh "git merge ${env.BRANCH_NAME}"
sh "git push origin develop"

//Release branch has been remotely deleted from 'origin'
sh "git push origin --delete ${env.BRANCH_NAME}"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}

}
}
}
stage('Paso 15: Merge con develop en Github') {
when { branch 'feature/*' }
steps {
withCredentials([
gitUsernamePassword(credentialsId: 'github-jenkins', gitToolName: 'Default')
]) {
script{
start = System.currentTimeMillis()
current_stage =env.STAGE_NAME
sh "echo 'Stage 15: Merging branch feature on develop'"
//Release branch has been merged into '$GITHUB_EMAIL'
sh "git config --global user.email '$GITHUB_EMAIL'"
sh "git config --global user.name '$GITHUB_USERNAME'"
sh "git checkout ${env.BRANCH_NAME}"
sh "git pull origin"

//merge into develop
sh "git checkout develop"
sh "git pull origin develop"
sh "git merge ${env.BRANCH_NAME}"
sh "git push origin develop"

//Release branch has been remotely deleted from 'origin'
sh "git push origin --delete ${env.BRANCH_NAME}"
end = System.currentTimeMillis()
build_duration_msg = build_duration_msg + "*" + current_stage + "*" + " : " + Util.getTimeSpanString(end - start) +"\n"
}

}
}
}
}
post{
always{
script{
build_duration_msg = build_duration_msg + "\n *Total build time:* " + "${currentBuild.durationString}".replaceAll(' and counting', "")
}
}
success{
script{
current_stage = "Post Build"
slackSend color: 'good', message: "[${NOMBRE_GRUPO}] [${env.JOB_NAME}][Rama : ${env.BRANCH_NAME}] [Stage :${current_stage}][Resultado: ${currentBuild.result}](<${env.BUILD_URL}|Detalle>)${build_duration_msg}", tokenCredentialId: 'id-token-slack'
}
}
failure{
slackSend color: 'danger', message: "[${NOMBRE_GRUPO}] [${env.JOB_NAME}][Rama : ${env.BRANCH_NAME}] [Stage :${current_stage}][Resultado:${currentBuild.result}](<${env.BUILD_URL}|Detalle>)${build_duration_msg}", tokenCredentialId: 'id-token-slack'
}
}
}
Loading