From cff4169d01c613ff9de640502c31ad78b048dcce Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:32:35 +0200 Subject: [PATCH 01/14] Update docker-image.yml --- .github/workflows/docker-image.yml | 81 ++++++++++++++++++------------ 1 file changed, 48 insertions(+), 33 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 58225a2..aa97692 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,40 +1,55 @@ -name: Docker Image CI +name: CI Workflow on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - workflow_dispatch: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 - build: + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- - runs-on: ubuntu-latest + - name: npm install and npm run CI commands + run: | + npm i + npm run test + npm run build - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v1 - with: - images: migupele/java_school_online_store_frontend - - - name: Build and push Docker image - uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 - with: - context: . - file: ./Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Build the Docker image + run: docker build . --file Dockerfile + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v1 + with: + images: migupele/java_school_online_store_frontend + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 85d0dd4d3ce92a88a821f1d9d5f75e707bafd413 Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:35:09 +0200 Subject: [PATCH 02/14] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f2ba369..1253973 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![Build Status](https://github.com/MiguelPelegrina/java_school_online_store_frontend/actions/workflows/ci.yml/badge.svg) + # Onlinestoreapp This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.0.1. From 8b26e4bdc3e4de42fc3e60016dc011a31ccf2dd9 Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:37:28 +0200 Subject: [PATCH 03/14] Update and rename docker-image.yml to ci.yml --- .github/workflows/{docker-image.yml => ci.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{docker-image.yml => ci.yml} (100%) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/docker-image.yml rename to .github/workflows/ci.yml From 6e486cb507a217fde07da122b51884aa9f2978b6 Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:46:51 +0200 Subject: [PATCH 04/14] Update README.md From 1ddda44bc8d7fcedd9a20b36502cf88cbe6842fb Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:50:33 +0200 Subject: [PATCH 05/14] Update ci.yml --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa97692..a9d6f9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,11 @@ name: CI Workflow on: push: - branches: [ main ] + branches: + - main pull_request: - branches: [ main ] + branches: + - main workflow_dispatch: jobs: From 841538135e6f2238b0408406feaf32dd399f005c Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:16:35 +0200 Subject: [PATCH 06/14] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9d6f9a..4b281de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI Workflow on: push: branches: - - main + - main pull_request: branches: - main From bc7231eea62e0327b7e1fc0d37d66607a0054471 Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:19:10 +0200 Subject: [PATCH 07/14] Update ci.yml --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b281de..91ecbfc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,6 @@ on: pull_request: branches: - main - workflow_dispatch: jobs: build: From 0b542f83d89d50964b96ef6874ae0f19f6295dbb Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:23:31 +0200 Subject: [PATCH 08/14] Update ci.yml --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91ecbfc..0035249 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,12 @@ name: CI Workflow on: - push: - branches: - - main - pull_request: - branches: - - main + push: + branches: + - main + pull_request: + branches: + - main jobs: build: From 925c5d53378896d0b1fef744f396efee8aa87619 Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:28:53 +0200 Subject: [PATCH 09/14] Update ci.yml --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0035249..5e2a911 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,11 @@ name: CI Workflow on: - push: - branches: - - main - pull_request: - branches: - - main + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: jobs: build: From b708a694fe18c4d795dfcd57669e4f9563e5bed8 Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:51:24 +0200 Subject: [PATCH 10/14] Update add-edit-user-form.component.spec.ts --- .../forms/user/add-edit-user-form.component.spec.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/components/user/forms/user/add-edit-user-form.component.spec.ts b/src/app/components/user/forms/user/add-edit-user-form.component.spec.ts index 0edc8ae..cb6552d 100644 --- a/src/app/components/user/forms/user/add-edit-user-form.component.spec.ts +++ b/src/app/components/user/forms/user/add-edit-user-form.component.spec.ts @@ -1,16 +1,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AddEditUserFormComponent } from './add-edit-user-form.component'; +import { AddEditUserForm } from './add-edit-user-form.component'; -describe('AddEditUserFormComponent', () => { - let component: AddEditUserFormComponent; - let fixture: ComponentFixture; +describe('AddEditUserForm', () => { + let component: AddEditUserForm; + let fixture: ComponentFixture; beforeEach(() => { TestBed.configureTestingModule({ - declarations: [AddEditUserFormComponent] + declarations: [AddEditUserForm] }); - fixture = TestBed.createComponent(AddEditUserFormComponent); + fixture = TestBed.createComponent(AddEditUserForm); component = fixture.componentInstance; fixture.detectChanges(); }); From e8d0098813f92671561ce2819658c8a548378798 Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:55:05 +0200 Subject: [PATCH 11/14] Update abstract.service.spec.ts --- src/app/shared/service/abstract.service.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/service/abstract.service.spec.ts b/src/app/shared/service/abstract.service.spec.ts index a60b275..5ad19df 100644 --- a/src/app/shared/service/abstract.service.spec.ts +++ b/src/app/shared/service/abstract.service.spec.ts @@ -4,7 +4,7 @@ import { AbstractService } from './abstract.service'; import { Country } from '../domain/country/country'; describe('AbstractService', () => { - let service: AbstractService; + let service: AbstractService; beforeEach(() => { TestBed.configureTestingModule({}); From 3c2746e4c4baa145231ffff017923d25a36b559e Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Wed, 10 Apr 2024 09:01:12 +0200 Subject: [PATCH 12/14] Update ci.yml --- .github/workflows/ci.yml | 77 ++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e2a911..272a7f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,55 +1,38 @@ -name: CI Workflow +name: Docker Image CI on: - push: + push: branches: [ "master" ] - pull_request: + pull_request: branches: [ "master" ] - workflow_dispatch: + workflow_dispatch: jobs: - build: + build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Cache node modules - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: npm install and npm run CI commands - run: | - npm i - npm run test - npm run build - - - name: Build the Docker image - run: docker build . --file Dockerfile - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v1 - with: - images: migupele/java_school_online_store_frontend - - - name: Build and push Docker image - uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 - with: - context: . - file: ./Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v1 + with: + images: migupele/java_school_online_store_frontend + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 32a3da302614477902a5d72e3c0181513ad6bf04 Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Wed, 10 Apr 2024 09:08:09 +0200 Subject: [PATCH 13/14] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 272a7f4..4faa56b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Docker Image CI +name: CI Workflow on: push: From 9c13b3eea0522da500c900fc28603075af806f1c Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Fri, 12 Apr 2024 10:10:08 +0000 Subject: [PATCH 14/14] fix: Dockerfile to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-ALPINE317-OPENSSL-6032385 - https://snyk.io/vuln/SNYK-UPSTREAM-NODE-3326683 - https://snyk.io/vuln/SNYK-UPSTREAM-NODE-3326688 - https://snyk.io/vuln/SNYK-UPSTREAM-NODE-5741793 - https://snyk.io/vuln/SNYK-UPSTREAM-NODE-5843454 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7461b48..2fca08e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18.13.0-alpine AS build +FROM node:18.20.0-alpine AS build WORKDIR /app COPY package*.json ./ EXPOSE 4200