From 5abf6a0aa34911a6b5145d27efffe10f8f4fab7c Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 14:44:59 -0300 Subject: [PATCH 01/30] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7bb74fc..32ea153 100644 --- a/README.md +++ b/README.md @@ -87,4 +87,5 @@ Ao completar cada workflow com sucesso, você ganha os badges: **Feito pela comunidade LINUXtips.** +Marcus Vinicius From 937c49886fb5aa38c1117acd17803659bddb596c Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Date: Fri, 3 Oct 2025 14:48:19 -0300 Subject: [PATCH 02/30] teste 01 --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 32ea153..e0637f7 100644 --- a/README.md +++ b/README.md @@ -88,4 +88,7 @@ Ao completar cada workflow com sucesso, você ganha os badges: **Feito pela comunidade LINUXtips.** Marcus Vinicius +<<<<<<< HEAD +======= +>>>>>>> 8f45690 (teste 01) From 5ac776a3c45b6c8720679f47c138f16f03f1a6b6 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:25:23 +0000 Subject: [PATCH 03/30] add git commit-2 --- .github/workflows/02-tests-ci.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 3a9801b..5e7227c 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -7,7 +7,7 @@ env: NODE_VERSION: '18' CHALLENGE_LEVEL: 2 CHALLENGE_NAME: "testes-automatizados" - COVERAGE_MIN: 80 # Cobertura mínima exigida em porcentagem + COVERAGE_MIN: 99 # Cobertura mínima exigida em porcentagem jobs: tests-and-coverage: @@ -20,10 +20,16 @@ jobs: - name: "Checkout do código" uses: actions/checkout@v4 - # INSIRA AQUI A LÓGICA PARA RODAR OS TESTES E VERIFICAR A COBERTURA - ### - ### - ### + - name: "Setup Node" + uses: actions/setup-node@v5 + with: + node-version: ${{env.NODE_VERSION}} + + - name: "Instalar dependencias" + run: npm ci + + - name: "Executar testes" + run: npm rum testes - name: "Extrair porcentagem de cobertura" # Esse step será validado pelo desafio, não altere o nome. No final, ele deve gerar o output "coverage" com a porcentagem de cobertura. id: coverage @@ -32,6 +38,12 @@ jobs: echo "Coverage: $COVERAGE%" echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT + - name: "Valida se os testes passaram" + if: ${{ steps.coverage.outputs.coverage < env.COVERAGE_MIN }} + run: | + echo: "Cobertura minima não atendida: Esperado - ${{ env.COVERAGE_MIN}}%. Atingido: ${{ steps.coverage.outputs.coverage }}%" + exit 1 + generate-certificate: # DAQUI PARA BAIXO, NÃO ALTERAR name: "Desafio Nível 2 - Certificado" runs-on: ubuntu-latest From fc41f0750823091501c7dc3c224eeec5b0fa5107 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:49:28 +0000 Subject: [PATCH 04/30] teste --- .github/workflows/02-tests-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 5e7227c..6142a52 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -7,7 +7,7 @@ env: NODE_VERSION: '18' CHALLENGE_LEVEL: 2 CHALLENGE_NAME: "testes-automatizados" - COVERAGE_MIN: 99 # Cobertura mínima exigida em porcentagem + COVERAGE_MIN: 98 # Cobertura mínima exigida em porcentagem jobs: tests-and-coverage: From d2fd64154e8e324d7dc2c8bcefc33b36af901733 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:58:18 +0000 Subject: [PATCH 05/30] teste1 --- .github/workflows/02-tests-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 6142a52..5e7227c 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -7,7 +7,7 @@ env: NODE_VERSION: '18' CHALLENGE_LEVEL: 2 CHALLENGE_NAME: "testes-automatizados" - COVERAGE_MIN: 98 # Cobertura mínima exigida em porcentagem + COVERAGE_MIN: 99 # Cobertura mínima exigida em porcentagem jobs: tests-and-coverage: From af402a68857670a0920630a4c8694351a009bbfb Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 19:00:40 +0000 Subject: [PATCH 06/30] teste2 --- .github/workflows/02-tests-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 5e7227c..aa5925e 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -23,7 +23,7 @@ jobs: - name: "Setup Node" uses: actions/setup-node@v5 with: - node-version: ${{env.NODE_VERSION}} + node-version: ${{ env.NODE_VERSION }} - name: "Instalar dependencias" run: npm ci From 06b4389ecda913de6d81a6b3c50ccc008feaf945 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 19:03:43 +0000 Subject: [PATCH 07/30] teste3 --- .github/workflows/02-tests-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index aa5925e..17f0011 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -7,7 +7,7 @@ env: NODE_VERSION: '18' CHALLENGE_LEVEL: 2 CHALLENGE_NAME: "testes-automatizados" - COVERAGE_MIN: 99 # Cobertura mínima exigida em porcentagem + COVERAGE_MIN: 98 # Cobertura mínima exigida em porcentagem jobs: tests-and-coverage: From c187682fb36a78e80f58d9f89e13e3e7881af81e Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 19:05:21 +0000 Subject: [PATCH 08/30] teste3 --- .github/workflows/02-tests-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 17f0011..53cafce 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -26,7 +26,7 @@ jobs: node-version: ${{ env.NODE_VERSION }} - name: "Instalar dependencias" - run: npm ci + run: npm install - name: "Executar testes" run: npm rum testes From c1aa2e32f934c77fd48c9f8662c2f9a81d80d2d4 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 19:09:05 +0000 Subject: [PATCH 09/30] ajustes de parametros --- .github/workflows/02-tests-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 53cafce..e390068 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -29,7 +29,7 @@ jobs: run: npm install - name: "Executar testes" - run: npm rum testes + run: npm run testes - name: "Extrair porcentagem de cobertura" # Esse step será validado pelo desafio, não altere o nome. No final, ele deve gerar o output "coverage" com a porcentagem de cobertura. id: coverage From b56b1a27a8050dbdacbee454e350fdc0b3a5c77f Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 19:10:29 +0000 Subject: [PATCH 10/30] ajustes de parametros --- .github/workflows/02-tests-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index e390068..5e53fe7 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -29,7 +29,7 @@ jobs: run: npm install - name: "Executar testes" - run: npm run testes + run: npm run tests - name: "Extrair porcentagem de cobertura" # Esse step será validado pelo desafio, não altere o nome. No final, ele deve gerar o output "coverage" com a porcentagem de cobertura. id: coverage From ae130ec3fbf29bcdcc8d4fb5586b28639907ee1a Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 19:45:55 +0000 Subject: [PATCH 11/30] ajustes de parametros2 --- .github/workflows/02-tests-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 5e53fe7..5a9b55e 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -41,7 +41,7 @@ jobs: - name: "Valida se os testes passaram" if: ${{ steps.coverage.outputs.coverage < env.COVERAGE_MIN }} run: | - echo: "Cobertura minima não atendida: Esperado - ${{ env.COVERAGE_MIN}}%. Atingido: ${{ steps.coverage.outputs.coverage }}%" + echo "Cobertura minima não atendida: Esperado - ${{ env.COVERAGE_MIN }}%. Atingido: ${{ steps.coverage.outputs.coverage }}%" exit 1 generate-certificate: # DAQUI PARA BAIXO, NÃO ALTERAR From f6631747eabfc161f966e022ecae306e45016029 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 19:51:29 +0000 Subject: [PATCH 12/30] resolution --- .github/workflows/02-tests-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 5a9b55e..147cf54 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -7,7 +7,7 @@ env: NODE_VERSION: '18' CHALLENGE_LEVEL: 2 CHALLENGE_NAME: "testes-automatizados" - COVERAGE_MIN: 98 # Cobertura mínima exigida em porcentagem + COVERAGE_MIN: 80 # Cobertura mínima exigida em porcentagem jobs: tests-and-coverage: From 470e8a127407c5084b06ee9ce72f094eb005aef7 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 20:14:02 +0000 Subject: [PATCH 13/30] teste de ci --- .github/workflows/02-tests-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 147cf54..013c811 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -1,7 +1,9 @@ name: "Nível 2: Testes Automatizados" on: pull_request: - branches: [ main ] + branches: + - main + - desafio-nivel-3 env: NODE_VERSION: '18' From ec7896e01c3b6ad64fca069f853fdbee7b74f0e2 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 20:36:14 +0000 Subject: [PATCH 14/30] teste de ci --- .github/workflows/03-build-containers.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index cbddc24..79c5581 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -21,6 +21,13 @@ jobs: runs-on: ubuntu-latest steps: + - name: Docker Login + uses: docker/login-action@v3.6.0 + with: + registry: ghcr.io + username: brasleiro01 + password: ${{ env.TOKEN_PAT}} + # AQUI VAI O CÓDIGO DO DESAFIO :) generate-certificate: # DAQUI PARA BAIXO, NÃO ALTERAR From 4e22228a99d081c5ba8d99ae8d079eab7c1e7e85 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 20:49:38 +0000 Subject: [PATCH 15/30] add docker login --- .github/workflows/03-build-containers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index 79c5581..0f69736 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -24,9 +24,9 @@ jobs: - name: Docker Login uses: docker/login-action@v3.6.0 with: - registry: ghcr.io + registry: ${{ env.REGISTRY }} username: brasleiro01 - password: ${{ env.TOKEN_PAT}} + password: ${{ env.TOKEN_PAT }} # AQUI VAI O CÓDIGO DO DESAFIO :) From 56082e931c9cd7cb3428faee61745027ef192ed6 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 20:53:12 +0000 Subject: [PATCH 16/30] add docker login --- .github/workflows/03-build-containers.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index 0f69736..5e1253b 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -22,11 +22,11 @@ jobs: steps: - name: Docker Login - uses: docker/login-action@v3.6.0 - with: - registry: ${{ env.REGISTRY }} - username: brasleiro01 - password: ${{ env.TOKEN_PAT }} + uses: docker/login-action@v3.6.0 + with: + registry: ${{ env.REGISTRY }} + username: brasleiro01 + password: ${{ env.TOKEN_PAT }} # AQUI VAI O CÓDIGO DO DESAFIO :) From 8eaf8826770b49f610856e9c9411d2582333502e Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 20:56:29 +0000 Subject: [PATCH 17/30] add docker login --- .github/workflows/03-build-containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index 5e1253b..948ccd0 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -26,7 +26,7 @@ jobs: with: registry: ${{ env.REGISTRY }} username: brasleiro01 - password: ${{ env.TOKEN_PAT }} + password: ${{ secrets.TOKEN_PAT }} # AQUI VAI O CÓDIGO DO DESAFIO :) From 1b6c161ed83db6a6218c280b60901f6f4fea6d7f Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:08:04 +0000 Subject: [PATCH 18/30] add hadolint --- .github/workflows/03-build-containers.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index 948ccd0..740e3d5 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -21,12 +21,25 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Docker Login uses: docker/login-action@v3.6.0 with: registry: ${{ env.REGISTRY }} username: brasleiro01 password: ${{ secrets.TOKEN_PAT }} + + - name: Rodar Hadolint + run: | + docker run --rm -i hadolint/hadolint < Dockerfile > lint-report.txt || true + cat lint-report.txt + # Falhar se encontrar DL3006 ou DL3008 + if grep -q "DL3006\|DL3008" lint-report.txt; then + echo "Erros críticos encontrados no Dockerfile!" + exit 1 + fi # AQUI VAI O CÓDIGO DO DESAFIO :) From da2f2b0132b9e12c62d30db8f7da14f6b87f3a72 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:14:19 +0000 Subject: [PATCH 19/30] add hadolint-1 --- .github/workflows/03-build-containers.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index 740e3d5..ee66173 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -31,6 +31,11 @@ jobs: username: brasleiro01 password: ${{ secrets.TOKEN_PAT }} + - name: Rodar Hadolint 1 + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + - name: Rodar Hadolint run: | docker run --rm -i hadolint/hadolint < Dockerfile > lint-report.txt || true From 13657f7c06c392dfa8b03524155edbd38d0f3e69 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:18:56 +0000 Subject: [PATCH 20/30] add hadolint-2 --- .github/workflows/03-build-containers.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index ee66173..310d9a8 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -31,18 +31,21 @@ jobs: username: brasleiro01 password: ${{ secrets.TOKEN_PAT }} - - name: Rodar Hadolint 1 - uses: hadolint/hadolint-action@v3.1.0 + - name: Rodar Hadolint + id: hadolint + uses: hadolint/hadolint-action@v3.3.0 with: dockerfile: Dockerfile - - - name: Rodar Hadolint + output-file: lint-report.txt + format: tty + no-color: true + no-fail: true + + - name: Validar Hadolint (DL3006 e DL3008) run: | - docker run --rm -i hadolint/hadolint < Dockerfile > lint-report.txt || true cat lint-report.txt - # Falhar se encontrar DL3006 ou DL3008 if grep -q "DL3006\|DL3008" lint-report.txt; then - echo "Erros críticos encontrados no Dockerfile!" + echo "❌ Erros críticos encontrados no Dockerfile!" exit 1 fi From a4e9fefaa669478d06086c526cd157382e6fa858 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:21:59 +0000 Subject: [PATCH 21/30] add hadolint-3 --- .github/workflows/03-build-containers.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index 310d9a8..caa0f3a 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -45,8 +45,10 @@ jobs: run: | cat lint-report.txt if grep -q "DL3006\|DL3008" lint-report.txt; then - echo "❌ Erros críticos encontrados no Dockerfile!" + echo "❌ Erros críticos encontrados no Dockerfile (DL3006 ou DL3008)!" exit 1 + else + echo "✅ Dockerfile passou no lint!" fi # AQUI VAI O CÓDIGO DO DESAFIO :) From e7c45232a82a765e4a1f02a412814a3b93a94d80 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:37:07 +0000 Subject: [PATCH 22/30] add build e run-1 --- .github/workflows/03-build-containers.yml | 29 +++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index caa0f3a..c6e1f7e 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -24,12 +24,25 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Definir variáveis da imagem + id: vars + run: | + OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') + REPO=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]') + REGISTRY=ghcr.io + TAG=${GITHUB_SHA::7} + + echo "REGISTRY=$REGISTRY" >> $GITHUB_ENV + echo "OWNER=$OWNER" >> $GITHUB_ENV + echo "IMAGE_NAME=$REPO" >> $GITHUB_ENV + echo "TAG=$TAG" >> $GITHUB_ENV + - name: Docker Login uses: docker/login-action@v3.6.0 with: registry: ${{ env.REGISTRY }} username: brasleiro01 - password: ${{ secrets.TOKEN_PAT }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Rodar Hadolint id: hadolint @@ -41,15 +54,23 @@ jobs: no-color: true no-fail: true - - name: Validar Hadolint (DL3006 e DL3008) + - name: Output (DL3006 e DL3008) run: | cat lint-report.txt if grep -q "DL3006\|DL3008" lint-report.txt; then - echo "❌ Erros críticos encontrados no Dockerfile (DL3006 ou DL3008)!" + echo "Erros críticos encontrados no Dockerfile (DL3006 ou DL3008)!" exit 1 else - echo "✅ Dockerfile passou no lint!" + echo "Dockerfile passou no lint!" fi + + - name: Build + uses: docker/build-push-action@v6.18.0 + with: + context: . + file: ./Dockerfile + load: true + tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} # AQUI VAI O CÓDIGO DO DESAFIO :) From 952dea1485541a492f0d025adcbfa4713a32c2af Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:41:31 +0000 Subject: [PATCH 23/30] add trivy-1 --- .github/workflows/03-build-containers.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index c6e1f7e..66382f5 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -70,7 +70,24 @@ jobs: context: . file: ./Dockerfile load: true - tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} + tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} + + - name: Scan de vulnerabilidades com Trivy + uses: aquasecurity/trivy-action@0.33.1 + with: + scan-type: image + image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ env.TAG }} + severity: CRITICAL + exit-code: 1 + format: table + output: trivy-report.txt + ignore-unfixed: true + + - name: Upload relatório Trivy + uses: actions/upload-artifact@v4 + with: + name: trivy-report + path: trivy-report.txt # AQUI VAI O CÓDIGO DO DESAFIO :) From d679a0962803b23251b0e9c613e587b5dc9acfdd Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:45:33 +0000 Subject: [PATCH 24/30] add trivy-2 --- .github/workflows/03-build-containers.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index 66382f5..8164f34 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -76,12 +76,11 @@ jobs: uses: aquasecurity/trivy-action@0.33.1 with: scan-type: image - image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ env.TAG }} + image-ref: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} severity: CRITICAL exit-code: 1 format: table output: trivy-report.txt - ignore-unfixed: true - name: Upload relatório Trivy uses: actions/upload-artifact@v4 From 4ac5e6d56496c39fd3337fc9e02ffdf1e09fbd51 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 22:05:23 +0000 Subject: [PATCH 25/30] add ajustes-2 --- .github/workflows/03-build-containers.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index 8164f34..293512c 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -30,11 +30,10 @@ jobs: OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') REPO=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]') REGISTRY=ghcr.io - TAG=${GITHUB_SHA::7} + TAG=${github.sha} echo "REGISTRY=$REGISTRY" >> $GITHUB_ENV echo "OWNER=$OWNER" >> $GITHUB_ENV - echo "IMAGE_NAME=$REPO" >> $GITHUB_ENV echo "TAG=$TAG" >> $GITHUB_ENV - name: Docker Login @@ -42,7 +41,7 @@ jobs: with: registry: ${{ env.REGISTRY }} username: brasleiro01 - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.TOKEN_PAT }} - name: Rodar Hadolint id: hadolint @@ -70,13 +69,13 @@ jobs: context: . file: ./Dockerfile load: true - tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} + tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ secrets.IMAGE_NAME }}:${{ env.TAG }} - name: Scan de vulnerabilidades com Trivy uses: aquasecurity/trivy-action@0.33.1 with: scan-type: image - image-ref: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} + image-ref: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ secrets.IMAGE_NAME }}:${{ env.TAG }} severity: CRITICAL exit-code: 1 format: table @@ -87,6 +86,14 @@ jobs: with: name: trivy-report path: trivy-report.txt + + - name: Push da imagem no GHCR + uses: docker/build-push-action@v6.18.0 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ secrets.IMAGE_NAME }}:${{ env.TAG }} # AQUI VAI O CÓDIGO DO DESAFIO :) From a79b051347f1fcf2fc3a09f42c73b0fe64018f96 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 22:07:25 +0000 Subject: [PATCH 26/30] add ajustes-2 --- .github/workflows/03-build-containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index 293512c..7bb8ae2 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -30,7 +30,7 @@ jobs: OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') REPO=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]') REGISTRY=ghcr.io - TAG=${github.sha} + TAG=${GITHUB_SHA} echo "REGISTRY=$REGISTRY" >> $GITHUB_ENV echo "OWNER=$OWNER" >> $GITHUB_ENV From ab0fb56adba55433f28975c81756e0314eb9689e Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 22:13:19 +0000 Subject: [PATCH 27/30] add ajustes-3 --- .github/workflows/03-build-containers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index 7bb8ae2..a648b56 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -31,7 +31,7 @@ jobs: REPO=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]') REGISTRY=ghcr.io TAG=${GITHUB_SHA} - + echo "REGISTRY=$REGISTRY" >> $GITHUB_ENV echo "OWNER=$OWNER" >> $GITHUB_ENV echo "TAG=$TAG" >> $GITHUB_ENV @@ -69,7 +69,7 @@ jobs: context: . file: ./Dockerfile load: true - tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ secrets.IMAGE_NAME }}:${{ env.TAG }} + tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} - name: Scan de vulnerabilidades com Trivy uses: aquasecurity/trivy-action@0.33.1 From a60cea170d3923f4e8f1a9ee72723113cac49ffb Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 22:16:03 +0000 Subject: [PATCH 28/30] add ajustes-3 --- .github/workflows/03-build-containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index a648b56..a9bd19a 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -31,7 +31,7 @@ jobs: REPO=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]') REGISTRY=ghcr.io TAG=${GITHUB_SHA} - + echo "IMAGE_NAME=${{ vars.IMAGE_NAME }}" >> $GITHUB_ENV echo "REGISTRY=$REGISTRY" >> $GITHUB_ENV echo "OWNER=$OWNER" >> $GITHUB_ENV echo "TAG=$TAG" >> $GITHUB_ENV From eba10baaa8bde0eaf1983f7fc953f1cf555b0910 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 22:17:41 +0000 Subject: [PATCH 29/30] add ajustes-3 --- .github/workflows/03-build-containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index a9bd19a..a9e1f20 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -75,7 +75,7 @@ jobs: uses: aquasecurity/trivy-action@0.33.1 with: scan-type: image - image-ref: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ secrets.IMAGE_NAME }}:${{ env.TAG }} + image-ref: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} severity: CRITICAL exit-code: 1 format: table From 2891e00f46c9deaada56c0f74091b9c75eebe285 Mon Sep 17 00:00:00 2001 From: Marcus Vinicius Pereira de Oliveira e Silva <81624768+brasleiro01@users.noreply.github.com> Date: Fri, 3 Oct 2025 22:19:10 +0000 Subject: [PATCH 30/30] add ajustes-3 --- .github/workflows/03-build-containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml index a9e1f20..4154d49 100644 --- a/.github/workflows/03-build-containers.yml +++ b/.github/workflows/03-build-containers.yml @@ -93,7 +93,7 @@ jobs: context: . file: ./Dockerfile push: true - tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ secrets.IMAGE_NAME }}:${{ env.TAG }} + tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} # AQUI VAI O CÓDIGO DO DESAFIO :)