Skip to content

Commit

Permalink
Merge branch 'release/1.14.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
alcfernandes committed Jul 12, 2021
2 parents b6d64a8 + ee01a2f commit 14f4a41
Show file tree
Hide file tree
Showing 35 changed files with 656 additions and 396 deletions.
275 changes: 92 additions & 183 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,201 +1,110 @@
pipeline {
environment {
branchname = env.BRANCH_NAME.toLowerCase()
kubeconfig = getKubeconf(env.branchname)
registryCredential = 'jenkins_registry'
}

agent {
node {
label 'py-uniformes'
}
node { label 'python-36-sigpae' }
}

options {
buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '5'))
buildDiscarder(logRotator(numToKeepStr: '15', artifactNumToKeepStr: '15'))
disableConcurrentBuilds()
skipDefaultCheckout()
skipDefaultCheckout()
}

stages {
stage('CheckOut') {
steps {
checkout scm
}
}

stage('Analise codigo') {
when {
branch 'develop'
}
steps {
sh 'sonar-scanner \
-Dsonar.projectKey=SME-PTRF-FrontEnd \
-Dsonar.sources=. \
-Dsonar.host.url=http://sonar.sme.prefeitura.sp.gov.br \
-Dsonar.login=7892685aa2f72a1dab209fc584b43f654e0e1b8d'
}
}

stage('Docker Build DEV') {
when {
branch 'develop'
}
steps {
sh 'echo build docker image desenvolvimento'
// Start JOB para build das imagens Docker e push SME Registry
script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,
jobId: "4eeb8a3d-d845-41c5-a7aa-8cacc6a04167",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
}
stage('CheckOut') {
steps { checkout scm }
}
}

stage('Deploy DEV') {
when {
branch 'develop'
}
steps {
sh 'echo Deploy ambiente desenvolvimento'
script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,
jobId: "087505bb-e6d6-4e44-9cf4-70d3fb71623b",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
}
}
}

stage('Docker Build HOM') {
when {
branch 'homolog'
}
steps {

script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,

//JOB DE BUILD
jobId: "902708ac-cd58-4959-a9b6-8769568362db",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
}
}
}


stage('Deploy HOM') {
when {
branch 'homolog'
}
steps {
timeout(time: 24, unit: "HOURS") {
// telegramSend("${JOB_NAME}...O Build ${BUILD_DISPLAY_NAME} - Requer uma aprovação para deploy !!!\n Consulte o log para detalhes -> [Job logs](${env.BUILD_URL}console)\n")
input message: 'Deseja realizar o deploy?', ok: 'SIM', submitter: 'ebufaino, ollyver_ottoboni, kelwy_oliveira, alessandro_fernandes, anderson_morais'
}
//Start JOB deploy Kubernetes

script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,
jobId: "bb5f3c18-d40e-48bd-861f-e71b7b5ae812",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
stage('AnaliseCodigo') {
when { branch 'homolog' }
steps {
withSonarQubeEnv('sonarqube-local'){
sh 'echo "[ INFO ] Iniciando analise Sonar..." && sonar-scanner \
-Dsonar.projectKey=SME-PTRF-FrontEnd \
-Dsonar.sources=.'
}
}
}
}

stage('Docker Build PROD') {
when {
branch 'master'
}
steps {

script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,

//JOB DE BUILD
jobId: "4162072c-52f7-4afa-ab70-d3c88e7f114c",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
}
}
}


stage('Deploy PROD') {
when {
branch 'master'
}
steps {
timeout(time: 24, unit: "HOURS") {
// telegramSend("${JOB_NAME}...O Build ${BUILD_DISPLAY_NAME} - Requer uma aprovação para deploy !!!\n Consulte o log para detalhes -> [Job logs](${env.BUILD_URL}console)\n")
input message: 'Deseja realizar o deploy?', ok: 'SIM', submitter: 'ebufaino, ollyver_ottoboni, kelwy_oliveira, alessandro_fernandes, anderson_morais'
}
//Start JOB deploy kubernetes

script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,
jobId: "eedd8718-9bea-429e-8a47-38971584069c",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
stage('Build') {
when { anyOf { branch 'master'; branch 'main'; branch "story/*"; branch 'develop'; branch 'release'; branch 'homolog'; } }
steps {
script {
imagename1 = "registry.sme.prefeitura.sp.gov.br/${env.branchname}/ptrf-frontend"
//imagename2 = "registry.sme.prefeitura.sp.gov.br/${env.branchname}/sme-outra"
dockerImage1 = docker.build(imagename1, "-f Dockerfile .")
//dockerImage2 = docker.build(imagename2, "-f Dockerfile_outro .")
docker.withRegistry( 'https://registry.sme.prefeitura.sp.gov.br', registryCredential ) {
dockerImage1.push()
//dockerImage2.push()
}
sh "docker rmi $imagename1"
//sh "docker rmi $imagename2"
}
}
}
}
}



stage('Deploy'){
when { anyOf { branch 'master'; branch 'main'; branch 'development'; branch 'develop'; branch 'release'; branch 'homolog'; } }
steps {
script{
if ( env.branchname == 'main' || env.branchname == 'master' || env.branchname == 'homolog' || env.branchname == 'release' ) {
sendTelegram("🤩 [Deploy ${env.branchname}] Job Name: ${JOB_NAME} \nBuild: ${BUILD_DISPLAY_NAME} \nMe aprove! \nLog: \n${env.BUILD_URL}")
timeout(time: 24, unit: "HOURS") {
input message: 'Deseja realizar o deploy?', ok: 'SIM', submitter: 'kelwy_oliveira, anderson_morais'
}
withCredentials([file(credentialsId: "${kubeconfig}", variable: 'config')]){
sh('cp $config '+"$home"+'/.kube/config')
sh 'kubectl rollout restart deployment/ptrf-frontend -n sme-ptrf'
sh('rm -f '+"$home"+'/.kube/config')
}
}
else{
withCredentials([file(credentialsId: "${kubeconfig}", variable: 'config')]){
sh('cp $config '+"$home"+'/.kube/config')
sh 'kubectl rollout restart deployment/ptrf-frontend -n sme-ptrf'
sh('rm -f '+"$home"+'/.kube/config')
}
}
}
}
}
}

post {
success { sendTelegram("🚀 Job Name: ${JOB_NAME} \nBuild: ${BUILD_DISPLAY_NAME} \nStatus: Success \nLog: \n${env.BUILD_URL}console") }
unstable { sendTelegram("💣 Job Name: ${JOB_NAME} \nBuild: ${BUILD_DISPLAY_NAME} \nStatus: Unstable \nLog: \n${env.BUILD_URL}console") }
failure { sendTelegram("💥 Job Name: ${JOB_NAME} \nBuild: ${BUILD_DISPLAY_NAME} \nStatus: Failure \nLog: \n${env.BUILD_URL}console") }
aborted { sendTelegram ("😥 Job Name: ${JOB_NAME} \nBuild: ${BUILD_DISPLAY_NAME} \nStatus: Aborted \nLog: \n${env.BUILD_URL}console") }
}
}
def sendTelegram(message) {
def encodedMessage = URLEncoder.encode(message, "UTF-8")
withCredentials([string(credentialsId: 'telegramToken', variable: 'TOKEN'),
string(credentialsId: 'telegramChatId', variable: 'CHAT_ID')]) {
response = httpRequest (consoleLogResponseBody: true,
contentType: 'APPLICATION_JSON',
httpMode: 'GET',
url: 'https://api.telegram.org/bot'+"$TOKEN"+'/sendMessage?text='+encodedMessage+'&chat_id='+"$CHAT_ID"+'&disable_web_page_preview=true',
validResponseCodes: '200')
return response
}
}
def getKubeconf(branchName) {
if("main".equals(branchName)) { return "config_prd"; }
else if ("master".equals(branchName)) { return "config_prd"; }
else if ("homolog".equals(branchName)) { return "config_hom"; }
else if ("release".equals(branchName)) { return "config_hom"; }
else if ("development".equals(branchName)) { return "config_dev"; }
else if ("develop".equals(branchName)) { return "config_dev"; }
}
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ Front da aplicação _SIG.Escola_ da Secretaria de Educação da cidade de São

License: MIT

Versão: 1.13.0
Versão: 1.14.0

## Release Notes

### 1.14.0 - 08/07/2021 - Entregas da Sprint 23
* UE > Créditos de recursos externos agora permitem editar/excluir uma saída vinculada
* UE > Agora se um crédito de recurso externo é excluido a saída vinculada também é
* UE > Melhorias no formulário de lançamento de recursos externos
* UE > O cadastro de membros da Associação agora pede o CPF quando tratar-se de um aluno
* UE > O lançamento de despesas do tipo capital, agora não traz mas valor default para a quantidade de itens
* DRE > Resumo de Recursos, alterada a cor de destaques
* DRE > Ajustes em textos diversos
* 🐞 Correção de bugs

### 1.13.0 - 23/06/2021 - Entregas da Sprint 22
* UE > Notificações sobre a proximidade do inicio do período de prestação de contas
* UE > Notificações sobre inicio do período de prestação de contas
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ptrf",
"version": "1.13.0",
"version": "1.14.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.27",
Expand Down
14 changes: 5 additions & 9 deletions src/componentes/Globais/Dashborard/DashboardCard.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import React from 'react'
import '../../../paginas/escolas/404/pagina-404.scss'
import {MsgImgLadoDireito} from "../../Globais/Mensagens/MsgImgLadoDireito";
import {MsgImgLadoDireito} from "../Mensagens/MsgImgLadoDireito";
import Img404 from '../../../assets/img/img-404.svg'
import {exibeDataPT_BR, exibeDateTimePT_BR, exibeValorFormatadoPT_BR} from '../../../utils/ValidacoesAdicionaisFormularios'
import {getAcoesAssociacao} from "../../../services/Dashboard.service";

export const DashboardCard = ({acoesAssociacao, corIconeFonte}) => {
const getCorSaldo = (valor_saldo) => {
return valor_saldo < 0 ? "texto-cor-vermelha" : "texto-cor-verde"
};
export const DashboardCard = ({acoesAssociacao, getCorSaldo, getCssDestaque}) => {
return (
<>
{acoesAssociacao.info_acoes && acoesAssociacao.info_acoes.length > 0 ? (
Expand All @@ -30,11 +26,11 @@ export const DashboardCard = ({acoesAssociacao, corIconeFonte}) => {
<p className="pt-1 mb-4">
Repasses no período: <strong>{exibeValorFormatadoPT_BR(acao.repasses_no_periodo)}</strong>
</p>
<p className={`pt-1 mb-4 texto-com-icone-${corIconeFonte}`}>
<p className={getCssDestaque(4)}>
Outras receitas: <strong>{exibeValorFormatadoPT_BR(acao.outras_receitas_no_periodo)}</strong>
</p>
<p className={`pt-1 mb-0 texto-com-icone-${corIconeFonte}`}>
Despesa declarada: <strong>{exibeValorFormatadoPT_BR(acao.despesas_no_periodo)}</strong>
<p className={getCssDestaque(0)}>
Despesa: <strong>{exibeValorFormatadoPT_BR(acao.despesas_no_periodo)}</strong>
</p>
{acao.acao_associacao_nome.trim() === 'PTRF' ? (
<p className="pt-1 pb-1 mb-0 mt-4">
Expand Down
11 changes: 4 additions & 7 deletions src/componentes/Globais/Dashborard/DashboardCardInfoConta.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from "react";
import {exibeValorFormatadoPT_BR} from "../../../utils/ValidacoesAdicionaisFormularios";

export const DashboardCardInfoConta = ({acoesAssociacao, corIconeFonte}) =>{
export const DashboardCardInfoConta = ({acoesAssociacao, getCorSaldo, getCssDestaque}) =>{
let info = acoesAssociacao.info_conta;
const getCorSaldo = (valor_saldo) => {
return valor_saldo < 0 ? "texto-cor-vermelha" : "texto-cor-verde"
};
return(
<>
{info &&
Expand All @@ -28,11 +25,11 @@ export const DashboardCardInfoConta = ({acoesAssociacao, corIconeFonte}) =>{
<p className="pt-1 mb-2">
Repasses no período: <strong>{exibeValorFormatadoPT_BR(info.repasses_no_periodo)}</strong>
</p>
<p className={`pt-1 mb-2 texto-com-icone-${corIconeFonte}`}>
<p className={getCssDestaque(2)}>
Outras receitas: <strong>{exibeValorFormatadoPT_BR(info.outras_receitas_no_periodo)}</strong>
</p>
<p className={`pt-1 mb-0 texto-com-icone-${corIconeFonte}`}>
Despesa declarada: <strong>{exibeValorFormatadoPT_BR(info.despesas_no_periodo)}</strong>
<p className={getCssDestaque(0)}>
Despesa: <strong>{exibeValorFormatadoPT_BR(info.despesas_no_periodo)}</strong>
</p>
</div>
<div className="col-12 col-md-6 pt-1 pb-1 ml-xl-4 container-lado-direito d-flex align-items-center">
Expand Down
Loading

0 comments on commit 14f4a41

Please sign in to comment.