From ba013e34fef7de52c73decd2a0287e0989ab4ed1 Mon Sep 17 00:00:00 2001 From: Panagiotis Bellias Date: Fri, 31 May 2024 16:04:41 +0300 Subject: [PATCH 01/10] [#101] Fix integration tests stage in workflow --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cf27d58..48be8e6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,6 +44,9 @@ jobs: distribution: 'adopt' architecture: 'x64' + - name: Copy env.properties + run: cp env.properties.example env.properties + - name: Run unit tests run: mvn verify From 386cb3423a57e06ad7e48411880eee497f1adbe3 Mon Sep 17 00:00:00 2001 From: Panagiotis Bellias Date: Fri, 31 May 2024 16:11:28 +0300 Subject: [PATCH 02/10] [#101] Fix JWT_EXPIRATION_TIME default value --- env.properties.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env.properties.example b/env.properties.example index 3c08643..0b2612d 100644 --- a/env.properties.example +++ b/env.properties.example @@ -4,7 +4,7 @@ DATABASE_USERNAME= DATABASE_PASSWORD= JWT_SECRET_KEY= -JWT_EXPIRATION_TIME= +JWT_EXPIRATION_TIME=3600000 SUPER_ADMIN_NAME= SUPER_ADMIN_EMAIL= From 131fa8c04e9db5e2198e7b8cb77fcc3aedd2ac6a Mon Sep 17 00:00:00 2001 From: Panagiotis Bellias Date: Fri, 31 May 2024 16:16:25 +0300 Subject: [PATCH 03/10] [#101] Fix env files for tests --- .github/workflows/ci.yaml | 4 +-- env.properties.example | 2 +- src/main/resources/application.test.yml | 41 +++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/application.test.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 48be8e6..2636ad8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,8 +44,8 @@ jobs: distribution: 'adopt' architecture: 'x64' - - name: Copy env.properties - run: cp env.properties.example env.properties + - name: Copy env files + run: cp env.properties.example env.properties && cp src/main/resources/application.test.yaml src/main/resources/application.yml - name: Run unit tests run: mvn verify diff --git a/env.properties.example b/env.properties.example index 0b2612d..3c08643 100644 --- a/env.properties.example +++ b/env.properties.example @@ -4,7 +4,7 @@ DATABASE_USERNAME= DATABASE_PASSWORD= JWT_SECRET_KEY= -JWT_EXPIRATION_TIME=3600000 +JWT_EXPIRATION_TIME= SUPER_ADMIN_NAME= SUPER_ADMIN_EMAIL= diff --git a/src/main/resources/application.test.yml b/src/main/resources/application.test.yml new file mode 100644 index 0000000..95a3f77 --- /dev/null +++ b/src/main/resources/application.test.yml @@ -0,0 +1,41 @@ +spring: + config: + import: file:env.properties + application: + name: aeroplanner-rest-api + datasource: + url: jdbc:postgresql://${DATABASE_HOST}/${DATABASE_NAME} + username: ${DATABASE_USERNAME} + password: ${DATABASE_PASSWORD} + jpa: + hibernate: + ddl-auto: update + open-in-view: false + mail: + host: smtp.gmail.com + port: 587 + username: ${GMAIL_USERNAME} + password: ${GMAIL_PASSWORD} + properties: + mail: + smtp: + auth: true + starttls: + enable: true + +security: + jwt: + secret-key: ce83b9f1cfe7f191cf5efb12770e4f0b61a0f287d5f2b48c47bda6c3f4d50c5d + expiration-time: 3600000 +server: + port: 8005 + +super: + admin: + name: ${SUPER_ADMIN_NAME} + email: ${SUPER_ADMIN_EMAIL} + password: ${SUPER_ADMIN_PASSWORD} + +logging: + level: + com.projects.aeroplannerrestapi: DEBUG # Set to WARN for production From c2f5df69ad3f9e2f081636acb68a62ef73d21571 Mon Sep 17 00:00:00 2001 From: Panagiotis Bellias Date: Fri, 31 May 2024 16:17:00 +0300 Subject: [PATCH 04/10] [#101] Fix test file suffix --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2636ad8..c28f7c7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,7 +45,7 @@ jobs: architecture: 'x64' - name: Copy env files - run: cp env.properties.example env.properties && cp src/main/resources/application.test.yaml src/main/resources/application.yml + run: cp env.properties.example env.properties && cp src/main/resources/application.test.yml src/main/resources/application.yml - name: Run unit tests run: mvn verify From fab1453d55b7aef114b393c45ad537fbede57da6 Mon Sep 17 00:00:00 2001 From: Panagiotis Bellias Date: Fri, 31 May 2024 16:19:58 +0300 Subject: [PATCH 05/10] Revert "[#101] Fix test file suffix" This reverts commit c2f5df69ad3f9e2f081636acb68a62ef73d21571. --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c28f7c7..2636ad8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,7 +45,7 @@ jobs: architecture: 'x64' - name: Copy env files - run: cp env.properties.example env.properties && cp src/main/resources/application.test.yml src/main/resources/application.yml + run: cp env.properties.example env.properties && cp src/main/resources/application.test.yaml src/main/resources/application.yml - name: Run unit tests run: mvn verify From f56f14c276cac78f656d3d392eb8ed9fddf0e33a Mon Sep 17 00:00:00 2001 From: Panagiotis Bellias Date: Fri, 31 May 2024 16:20:06 +0300 Subject: [PATCH 06/10] Revert "[#101] Fix env files for tests" This reverts commit 131fa8c04e9db5e2198e7b8cb77fcc3aedd2ac6a. --- .github/workflows/ci.yaml | 4 +-- env.properties.example | 2 +- src/main/resources/application.test.yml | 41 ------------------------- 3 files changed, 3 insertions(+), 44 deletions(-) delete mode 100644 src/main/resources/application.test.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2636ad8..48be8e6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,8 +44,8 @@ jobs: distribution: 'adopt' architecture: 'x64' - - name: Copy env files - run: cp env.properties.example env.properties && cp src/main/resources/application.test.yaml src/main/resources/application.yml + - name: Copy env.properties + run: cp env.properties.example env.properties - name: Run unit tests run: mvn verify diff --git a/env.properties.example b/env.properties.example index 3c08643..0b2612d 100644 --- a/env.properties.example +++ b/env.properties.example @@ -4,7 +4,7 @@ DATABASE_USERNAME= DATABASE_PASSWORD= JWT_SECRET_KEY= -JWT_EXPIRATION_TIME= +JWT_EXPIRATION_TIME=3600000 SUPER_ADMIN_NAME= SUPER_ADMIN_EMAIL= diff --git a/src/main/resources/application.test.yml b/src/main/resources/application.test.yml deleted file mode 100644 index 95a3f77..0000000 --- a/src/main/resources/application.test.yml +++ /dev/null @@ -1,41 +0,0 @@ -spring: - config: - import: file:env.properties - application: - name: aeroplanner-rest-api - datasource: - url: jdbc:postgresql://${DATABASE_HOST}/${DATABASE_NAME} - username: ${DATABASE_USERNAME} - password: ${DATABASE_PASSWORD} - jpa: - hibernate: - ddl-auto: update - open-in-view: false - mail: - host: smtp.gmail.com - port: 587 - username: ${GMAIL_USERNAME} - password: ${GMAIL_PASSWORD} - properties: - mail: - smtp: - auth: true - starttls: - enable: true - -security: - jwt: - secret-key: ce83b9f1cfe7f191cf5efb12770e4f0b61a0f287d5f2b48c47bda6c3f4d50c5d - expiration-time: 3600000 -server: - port: 8005 - -super: - admin: - name: ${SUPER_ADMIN_NAME} - email: ${SUPER_ADMIN_EMAIL} - password: ${SUPER_ADMIN_PASSWORD} - -logging: - level: - com.projects.aeroplannerrestapi: DEBUG # Set to WARN for production From 7e7baac4bcb85d18d0df7ff4df53cd35daf38df0 Mon Sep 17 00:00:00 2001 From: Panagiotis Bellias Date: Fri, 31 May 2024 16:22:39 +0300 Subject: [PATCH 07/10] [#101] Fix JWT_SECRET_KEY default value --- env.properties.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env.properties.example b/env.properties.example index 0b2612d..03cb22c 100644 --- a/env.properties.example +++ b/env.properties.example @@ -3,7 +3,7 @@ DATABASE_HOST= DATABASE_USERNAME= DATABASE_PASSWORD= -JWT_SECRET_KEY= +JWT_SECRET_KEY=ce83b9f1cfe7f191cf5efb12770e4f0b61a0f287d5f2b48c47bda6c3f4d50c5d JWT_EXPIRATION_TIME=3600000 SUPER_ADMIN_NAME= From bc7bef1cc0e21ea94e26224622578cbf97a49c3b Mon Sep 17 00:00:00 2001 From: Panagiotis Bellias Date: Fri, 31 May 2024 16:30:50 +0300 Subject: [PATCH 08/10] [#101] Add exclusion rules for GitGuardian --- .gitguardian.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitguardian.yml diff --git a/.gitguardian.yml b/.gitguardian.yml new file mode 100644 index 0000000..d6e06e3 --- /dev/null +++ b/.gitguardian.yml @@ -0,0 +1,2 @@ +exclusions: + - "env.properties.example" From 65e6cd27aff1dc8dbcdb59fbbdf5b74f49a0770e Mon Sep 17 00:00:00 2001 From: Panagiotis Bellias Date: Fri, 31 May 2024 16:32:28 +0300 Subject: [PATCH 09/10] [#101] Automate github username for docker image push --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 48be8e6..2bb0e88 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -76,13 +76,13 @@ jobs: run: mvn -B package --file pom.xml -DskipTests - name: Docker Build - run: docker build -t ghcr.io/${{ secrets.REGISTRY_USERNAME }}/aeroplanner-rest-api:latest -t ghcr.io/${{ secrets.REGISTRY_USERNAME }}/aeroplanner-rest-api:0.0.1-SNAPSHOT . + run: docker build -t ghcr.io/${{ github.actor }}/aeroplanner-rest-api:latest -t ghcr.io/${{ github.actor }}/aeroplanner-rest-api:0.0.1-SNAPSHOT . - name: Docker login - run: docker login ghcr.io -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_TOKEN }} + run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.REGISTRY_TOKEN }} - name: Docker push - run: docker push ghcr.io/${{ secrets.REGISTRY_USERNAME }}/aeroplanner-rest-api --all-tags + run: docker push ghcr.io/${{ github.actor }}/aeroplanner-rest-api --all-tags # sonar: # runs-on: ubuntu-latest From 09d6b4308d2bccba4d8d3839355b67e4ed66312c Mon Sep 17 00:00:00 2001 From: Panagiotis Bellias Date: Fri, 31 May 2024 16:35:09 +0300 Subject: [PATCH 10/10] Revert "[#101] Automate github username for docker image push" This reverts commit 65e6cd27aff1dc8dbcdb59fbbdf5b74f49a0770e. --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2bb0e88..48be8e6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -76,13 +76,13 @@ jobs: run: mvn -B package --file pom.xml -DskipTests - name: Docker Build - run: docker build -t ghcr.io/${{ github.actor }}/aeroplanner-rest-api:latest -t ghcr.io/${{ github.actor }}/aeroplanner-rest-api:0.0.1-SNAPSHOT . + run: docker build -t ghcr.io/${{ secrets.REGISTRY_USERNAME }}/aeroplanner-rest-api:latest -t ghcr.io/${{ secrets.REGISTRY_USERNAME }}/aeroplanner-rest-api:0.0.1-SNAPSHOT . - name: Docker login - run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.REGISTRY_TOKEN }} + run: docker login ghcr.io -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_TOKEN }} - name: Docker push - run: docker push ghcr.io/${{ github.actor }}/aeroplanner-rest-api --all-tags + run: docker push ghcr.io/${{ secrets.REGISTRY_USERNAME }}/aeroplanner-rest-api --all-tags # sonar: # runs-on: ubuntu-latest