This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages { | |
//------------------------------------------------ESTAGIO 01--------------------------------------------------------------------------- | |
stage('Load Parameters'){ | |
steps{ | |
script { | |
dir ('Arquivos'){ //Fetch dos arquivos repositório do projeto para a pasta Arquivos, dentro do workspace do Jenkins | |
checkout([$class: 'GitSCM', branches: [[name: "master"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout']], gitTool: '${gitInit}', submoduleCfg: [], userRemoteConfigs: [[credentialsId: credentialId, url: "https://github.com/matheusvt2/jenkins-python-full-pipeline.git"]]]) | |
} | |
tools = load "${WORKSPACE}/Arquivos/Jenkins/jenkins-python-full-pipeline.groovy" //Carrega dados do arquivo de config deste projeto na pasta Jenkins (tem que estar no GIT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stage('Quality Tests'){ | |
parallel{ | |
stage ('Lynt Test'){ | |
steps{ | |
script{ | |
pyLynt("Arquivos",100) | |
} | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
post {//Apos o build (com ou sem erros) sempre executa esses comandos | |
always { | |
script{ | |
if(env.ProjectEnv == "VENV"){ | |
println "Apagando arquivos temporários..." | |
sh "conda remove --yes -p ${WORKSPACE}/VirtualEnv/${BUILD_TAG} --all" | |
sh ''' cd ${WORKSPACE} | |
ls -la | |
rm -fr * | |
ls -la |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stage('Exec Program'){ | |
steps { | |
script { | |
if(env.ExecutarPrograma == "SIM" && env.ProjectLang == "PYTHON" && env.ProjectEnv == "DOCKER"){ | |
withCredentials([usernamePassword(credentialsId: dockerCredentials, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { | |
funcSshCommand(sshprofile,""" | |
docker container rm jenkins-python-full-pipeline_container | |
docker login -u ${USERNAME} -p ${PASSWORD} | |
docker pull ${dockerhub}/jenkins-python-full-pipeline:${BUILD_NUMBER} | |
docker run --name jenkins-python-full-pipeline_container ${dockerhub}/jenkins-python-full-pipeline:${BUILD_NUMBER} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import speedtest | |
from datetime import datetime | |
import sqlite3 | |
import logging | |
from threading import Timer | |
logging.basicConfig(format='%(levelname)s - %(asctime)s - %(message)s', level=logging.INFO) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/Documents | |
hugo new site myhugosite | |
cd myhugosite |