From b0ab0266ec15f866e13f1e089e27597a52151279 Mon Sep 17 00:00:00 2001 From: marianalopes Date: Thu, 23 Jan 2025 21:25:44 +0100 Subject: [PATCH 01/12] refactor: remove make up from makefile --- Makefile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Makefile b/Makefile index 4d163518..c8ffb5e8 100644 --- a/Makefile +++ b/Makefile @@ -154,15 +154,6 @@ set-env: cp -r $(AUDIT_DIR)/.env.example $(AUDIT_DIR)/.env @echo "$(BLUE)Environment files created successfully$(NC)" -.PHONY: up -up: - @echo "$(BLUE)Starting all services...$(NC)" - @$(DOCKER_CMD) -f $(AUTH_DIR)/docker-compose.yml up --build -d - @$(DOCKER_CMD) -f $(INFRA_DIR)/docker-compose.yml up --build -d - @$(DOCKER_CMD) -f $(LEDGER_DIR)/docker-compose.yml up --build -d - @$(DOCKER_CMD) -f $(TRANSACTION_DIR)/docker-compose.yml up --build -d - @echo "$(BLUE)All services started successfully$(NC)" - .PHONY: auth auth: @echo "$(BLUE)Executing command in auth service...$(NC)" From 10ecb01efbdc14952592df89b86432fd3422cc24 Mon Sep 17 00:00:00 2001 From: marianalopes Date: Thu, 23 Jan 2025 21:36:43 +0100 Subject: [PATCH 02/12] fix: change make up to make all-services COMMAND="up" --- .github/workflows/go-combined-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go-combined-analysis.yml b/.github/workflows/go-combined-analysis.yml index 330d3cee..ad9b3905 100644 --- a/.github/workflows/go-combined-analysis.yml +++ b/.github/workflows/go-combined-analysis.yml @@ -137,7 +137,7 @@ jobs: run: make set-env - name: Start Docker Compose Services - run: make up + run: make all-services COMMAND="up" - name: Install CLI run: cd components/mdz && make install-local && cd - From 79f1525fb127bf1f7e27f09c8f6778829664d2d2 Mon Sep 17 00:00:00 2001 From: marianalopes Date: Thu, 23 Jan 2025 21:55:10 +0100 Subject: [PATCH 03/12] fix: rollback commands; --- .github/workflows/go-combined-analysis.yml | 2 +- Makefile | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go-combined-analysis.yml b/.github/workflows/go-combined-analysis.yml index ad9b3905..330d3cee 100644 --- a/.github/workflows/go-combined-analysis.yml +++ b/.github/workflows/go-combined-analysis.yml @@ -137,7 +137,7 @@ jobs: run: make set-env - name: Start Docker Compose Services - run: make all-services COMMAND="up" + run: make up - name: Install CLI run: cd components/mdz && make install-local && cd - diff --git a/Makefile b/Makefile index 3c217325..f6c8d5c5 100644 --- a/Makefile +++ b/Makefile @@ -185,6 +185,15 @@ audit: @echo "$(BLUE)Executing command in audit service...$(NC)" $(MAKE) -C $(AUDIT_DIR) $(COMMAND) +.PHONY: up +up: + @echo "$(BLUE)Starting all services...$(NC)" + @$(DOCKER_CMD) -f $(AUTH_DIR)/docker-compose.yml up --build -d + @$(DOCKER_CMD) -f $(INFRA_DIR)/docker-compose.yml up --build -d + @$(DOCKER_CMD) -f $(LEDGER_DIR)/docker-compose.yml up --build -d + @$(DOCKER_CMD) -f $(TRANSACTION_DIR)/docker-compose.yml up --build -d + @echo "$(BLUE)All services started successfully$(NC)" + .PHONY: all-services all-services: @echo "$(BLUE)Executing command across all services...$(NC)" From 902fc294bc35bb16dca76435be6939ad17f0e558 Mon Sep 17 00:00:00 2001 From: marianalopes Date: Thu, 23 Jan 2025 22:03:18 +0100 Subject: [PATCH 04/12] fix: add env workflows --- .github/workflows/update-env-version.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-env-version.yml b/.github/workflows/update-env-version.yml index 7dd1db57..89339c9e 100644 --- a/.github/workflows/update-env-version.yml +++ b/.github/workflows/update-env-version.yml @@ -19,6 +19,8 @@ jobs: update-env-release: name: Run update VERSION in every ENV on components runs-on: ubuntu-24.04 + environment: + name: fork-workflows steps: - uses: actions/create-github-app-token@v1 id: app-token From 290630ba3c6de8310d35b342eed6ea86ad2485fb Mon Sep 17 00:00:00 2001 From: marianalopes Date: Thu, 23 Jan 2025 22:09:01 +0100 Subject: [PATCH 05/12] fix: remove env fork-workflows --- .github/workflows/update-env-version.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/update-env-version.yml b/.github/workflows/update-env-version.yml index 89339c9e..7dd1db57 100644 --- a/.github/workflows/update-env-version.yml +++ b/.github/workflows/update-env-version.yml @@ -19,8 +19,6 @@ jobs: update-env-release: name: Run update VERSION in every ENV on components runs-on: ubuntu-24.04 - environment: - name: fork-workflows steps: - uses: actions/create-github-app-token@v1 id: app-token From 38be5d95569f37bc8f163b51396f74570cc8e158 Mon Sep 17 00:00:00 2001 From: marianalopes Date: Fri, 24 Jan 2025 10:59:04 +0100 Subject: [PATCH 06/12] fix: test pull_request_target to try to run action on midaz principal context --- .github/workflows/go-combined-analysis.yml | 2 +- .github/workflows/update-env-version.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go-combined-analysis.yml b/.github/workflows/go-combined-analysis.yml index 330d3cee..951353a9 100644 --- a/.github/workflows/go-combined-analysis.yml +++ b/.github/workflows/go-combined-analysis.yml @@ -1,7 +1,7 @@ name: "Go Combined Analysis" on: - pull_request: + pull_request_target: branches: - develop - main diff --git a/.github/workflows/update-env-version.yml b/.github/workflows/update-env-version.yml index 7dd1db57..8c71d3d7 100644 --- a/.github/workflows/update-env-version.yml +++ b/.github/workflows/update-env-version.yml @@ -1,7 +1,7 @@ name: Update Envs Version With TAG Release on: - pull_request: + pull_request_target: branches: - develop types: From 64590eade120d5b1c69f2eaaf03fbd5a6098fb18 Mon Sep 17 00:00:00 2001 From: marianalopes Date: Fri, 24 Jan 2025 11:30:04 +0100 Subject: [PATCH 07/12] fix: remove make up from general make; --- .github/workflows/go-combined-analysis.yml | 2 +- Makefile | 9 --------- components/audit/Makefile | 4 ++-- components/auth/Makefile | 4 ++-- components/infra/Makefile | 4 ++-- components/ledger/Makefile | 4 ++-- components/transaction/Makefile | 4 ++-- 7 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.github/workflows/go-combined-analysis.yml b/.github/workflows/go-combined-analysis.yml index 951353a9..42cb3af9 100644 --- a/.github/workflows/go-combined-analysis.yml +++ b/.github/workflows/go-combined-analysis.yml @@ -137,7 +137,7 @@ jobs: run: make set-env - name: Start Docker Compose Services - run: make up + run: make all-services COMMAND="build" - name: Install CLI run: cd components/mdz && make install-local && cd - diff --git a/Makefile b/Makefile index f6c8d5c5..3c217325 100644 --- a/Makefile +++ b/Makefile @@ -185,15 +185,6 @@ audit: @echo "$(BLUE)Executing command in audit service...$(NC)" $(MAKE) -C $(AUDIT_DIR) $(COMMAND) -.PHONY: up -up: - @echo "$(BLUE)Starting all services...$(NC)" - @$(DOCKER_CMD) -f $(AUTH_DIR)/docker-compose.yml up --build -d - @$(DOCKER_CMD) -f $(INFRA_DIR)/docker-compose.yml up --build -d - @$(DOCKER_CMD) -f $(LEDGER_DIR)/docker-compose.yml up --build -d - @$(DOCKER_CMD) -f $(TRANSACTION_DIR)/docker-compose.yml up --build -d - @echo "$(BLUE)All services started successfully$(NC)" - .PHONY: all-services all-services: @echo "$(BLUE)Executing command across all services...$(NC)" diff --git a/components/audit/Makefile b/components/audit/Makefile index a9828017..c61867ea 100644 --- a/components/audit/Makefile +++ b/components/audit/Makefile @@ -48,11 +48,11 @@ info: # Docker Compose Commands .PHONY: build build: - @$(DOCKER_CMD) -f docker-compose.yml build $(c) + @$(DOCKER_CMD) -f docker-compose.yml up --build -d $(c) .PHONY: up up: - @$(DOCKER_CMD) -f docker-compose.yml up $(c) -d + @$(DOCKER_CMD) -f docker-compose.yml up -d $(c) .PHONY: start start: diff --git a/components/auth/Makefile b/components/auth/Makefile index 3eaa37e8..e73189b6 100644 --- a/components/auth/Makefile +++ b/components/auth/Makefile @@ -44,11 +44,11 @@ info: # Docker Compose Commands .PHONY: build build: - @$(DOCKER_CMD) -f docker-compose.yml build $(c) + @$(DOCKER_CMD) -f docker-compose.yml up --build -d $(c) .PHONY: up up: - @$(DOCKER_CMD) -f docker-compose.yml up $(c) -d + @$(DOCKER_CMD) -f docker-compose.yml up -d $(c) .PHONY: start start: diff --git a/components/infra/Makefile b/components/infra/Makefile index a398aca3..13cfe1a8 100644 --- a/components/infra/Makefile +++ b/components/infra/Makefile @@ -44,11 +44,11 @@ info: # Docker Compose Commands .PHONY: build build: - @$(DOCKER_CMD) -f docker-compose.yml build $(c) + @$(DOCKER_CMD) -f docker-compose.yml up --build -d $(c) .PHONY: up up: - @$(DOCKER_CMD) -f docker-compose.yml up $(c) -d + @$(DOCKER_CMD) -f docker-compose.yml up -d $(c) .PHONY: start start: diff --git a/components/ledger/Makefile b/components/ledger/Makefile index faebdd87..e9bd1936 100644 --- a/components/ledger/Makefile +++ b/components/ledger/Makefile @@ -53,11 +53,11 @@ info: # Docker Compose Commands .PHONY: build build: - @$(DOCKER_CMD) -f docker-compose.yml build $(c) + @$(DOCKER_CMD) -f docker-compose.yml up --build -d $(c) .PHONY: up up: - @$(DOCKER_CMD) -f docker-compose.yml up $(c) -d + @$(DOCKER_CMD) -f docker-compose.yml up -d $(c) .PHONY: start start: diff --git a/components/transaction/Makefile b/components/transaction/Makefile index 938694f4..b84fc112 100644 --- a/components/transaction/Makefile +++ b/components/transaction/Makefile @@ -57,11 +57,11 @@ info: # Docker Compose Commands .PHONY: build build: - @$(DOCKER_CMD) -f docker-compose.yml build $(c) + @$(DOCKER_CMD) -f docker-compose.yml up --build -d $(c) .PHONY: up up: - @$(DOCKER_CMD) -f docker-compose.yml up $(c) -d + @$(DOCKER_CMD) -f docker-compose.yml up -d $(c) .PHONY: start start: From cee42285a3264fa93bfa8a21f109a89f9ac1fcf9 Mon Sep 17 00:00:00 2001 From: marianalopes Date: Fri, 24 Jan 2025 15:14:12 +0100 Subject: [PATCH 08/12] fix: revert pull_request --- .github/workflows/go-combined-analysis.yml | 2 +- .github/workflows/update-env-version.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go-combined-analysis.yml b/.github/workflows/go-combined-analysis.yml index 42cb3af9..0db5218c 100644 --- a/.github/workflows/go-combined-analysis.yml +++ b/.github/workflows/go-combined-analysis.yml @@ -1,7 +1,7 @@ name: "Go Combined Analysis" on: - pull_request_target: + pull_request: branches: - develop - main diff --git a/.github/workflows/update-env-version.yml b/.github/workflows/update-env-version.yml index 8c71d3d7..7dd1db57 100644 --- a/.github/workflows/update-env-version.yml +++ b/.github/workflows/update-env-version.yml @@ -1,7 +1,7 @@ name: Update Envs Version With TAG Release on: - pull_request_target: + pull_request: branches: - develop types: From 4cf665bc1a4405c83057129eca40d23cff08e4ec Mon Sep 17 00:00:00 2001 From: marianalopes Date: Fri, 24 Jan 2025 15:20:15 +0100 Subject: [PATCH 09/12] fix: rollback all changes --- .github/workflows/go-combined-analysis.yml | 2 +- Makefile | 9 +++++++++ components/audit/Makefile | 4 ++-- components/auth/Makefile | 4 ++-- components/infra/Makefile | 4 ++-- components/ledger/Makefile | 4 ++-- components/transaction/Makefile | 4 ++-- 7 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/go-combined-analysis.yml b/.github/workflows/go-combined-analysis.yml index 0db5218c..330d3cee 100644 --- a/.github/workflows/go-combined-analysis.yml +++ b/.github/workflows/go-combined-analysis.yml @@ -137,7 +137,7 @@ jobs: run: make set-env - name: Start Docker Compose Services - run: make all-services COMMAND="build" + run: make up - name: Install CLI run: cd components/mdz && make install-local && cd - diff --git a/Makefile b/Makefile index 3c217325..f6c8d5c5 100644 --- a/Makefile +++ b/Makefile @@ -185,6 +185,15 @@ audit: @echo "$(BLUE)Executing command in audit service...$(NC)" $(MAKE) -C $(AUDIT_DIR) $(COMMAND) +.PHONY: up +up: + @echo "$(BLUE)Starting all services...$(NC)" + @$(DOCKER_CMD) -f $(AUTH_DIR)/docker-compose.yml up --build -d + @$(DOCKER_CMD) -f $(INFRA_DIR)/docker-compose.yml up --build -d + @$(DOCKER_CMD) -f $(LEDGER_DIR)/docker-compose.yml up --build -d + @$(DOCKER_CMD) -f $(TRANSACTION_DIR)/docker-compose.yml up --build -d + @echo "$(BLUE)All services started successfully$(NC)" + .PHONY: all-services all-services: @echo "$(BLUE)Executing command across all services...$(NC)" diff --git a/components/audit/Makefile b/components/audit/Makefile index c61867ea..a9828017 100644 --- a/components/audit/Makefile +++ b/components/audit/Makefile @@ -48,11 +48,11 @@ info: # Docker Compose Commands .PHONY: build build: - @$(DOCKER_CMD) -f docker-compose.yml up --build -d $(c) + @$(DOCKER_CMD) -f docker-compose.yml build $(c) .PHONY: up up: - @$(DOCKER_CMD) -f docker-compose.yml up -d $(c) + @$(DOCKER_CMD) -f docker-compose.yml up $(c) -d .PHONY: start start: diff --git a/components/auth/Makefile b/components/auth/Makefile index e73189b6..3eaa37e8 100644 --- a/components/auth/Makefile +++ b/components/auth/Makefile @@ -44,11 +44,11 @@ info: # Docker Compose Commands .PHONY: build build: - @$(DOCKER_CMD) -f docker-compose.yml up --build -d $(c) + @$(DOCKER_CMD) -f docker-compose.yml build $(c) .PHONY: up up: - @$(DOCKER_CMD) -f docker-compose.yml up -d $(c) + @$(DOCKER_CMD) -f docker-compose.yml up $(c) -d .PHONY: start start: diff --git a/components/infra/Makefile b/components/infra/Makefile index 13cfe1a8..a398aca3 100644 --- a/components/infra/Makefile +++ b/components/infra/Makefile @@ -44,11 +44,11 @@ info: # Docker Compose Commands .PHONY: build build: - @$(DOCKER_CMD) -f docker-compose.yml up --build -d $(c) + @$(DOCKER_CMD) -f docker-compose.yml build $(c) .PHONY: up up: - @$(DOCKER_CMD) -f docker-compose.yml up -d $(c) + @$(DOCKER_CMD) -f docker-compose.yml up $(c) -d .PHONY: start start: diff --git a/components/ledger/Makefile b/components/ledger/Makefile index e9bd1936..faebdd87 100644 --- a/components/ledger/Makefile +++ b/components/ledger/Makefile @@ -53,11 +53,11 @@ info: # Docker Compose Commands .PHONY: build build: - @$(DOCKER_CMD) -f docker-compose.yml up --build -d $(c) + @$(DOCKER_CMD) -f docker-compose.yml build $(c) .PHONY: up up: - @$(DOCKER_CMD) -f docker-compose.yml up -d $(c) + @$(DOCKER_CMD) -f docker-compose.yml up $(c) -d .PHONY: start start: diff --git a/components/transaction/Makefile b/components/transaction/Makefile index b84fc112..938694f4 100644 --- a/components/transaction/Makefile +++ b/components/transaction/Makefile @@ -57,11 +57,11 @@ info: # Docker Compose Commands .PHONY: build build: - @$(DOCKER_CMD) -f docker-compose.yml up --build -d $(c) + @$(DOCKER_CMD) -f docker-compose.yml build $(c) .PHONY: up up: - @$(DOCKER_CMD) -f docker-compose.yml up -d $(c) + @$(DOCKER_CMD) -f docker-compose.yml up $(c) -d .PHONY: start start: From abb0628d210017923713ec0f62cb3e08867c4911 Mon Sep 17 00:00:00 2001 From: marianalopes Date: Wed, 29 Jan 2025 10:06:24 +0100 Subject: [PATCH 10/12] fix: change this job to don't run if came from a fork. --- .github/workflows/update-env-version.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-env-version.yml b/.github/workflows/update-env-version.yml index 7dd1db57..9cb13f32 100644 --- a/.github/workflows/update-env-version.yml +++ b/.github/workflows/update-env-version.yml @@ -17,6 +17,7 @@ permissions: jobs: update-env-release: + if: github.event.pull_request.head.repo.fork == false name: Run update VERSION in every ENV on components runs-on: ubuntu-24.04 steps: From 7a6714b1dc11f5e2c3a41754c70ad93d8632fe42 Mon Sep 17 00:00:00 2001 From: marianalopes Date: Wed, 29 Jan 2025 10:25:47 +0100 Subject: [PATCH 11/12] fix: change this job to don't run this step if came for a fork. --- .github/workflows/go-combined-analysis.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go-combined-analysis.yml b/.github/workflows/go-combined-analysis.yml index 330d3cee..13aaed67 100644 --- a/.github/workflows/go-combined-analysis.yml +++ b/.github/workflows/go-combined-analysis.yml @@ -52,13 +52,16 @@ jobs: name: Run GoLangCI-Lint to Midaz runs-on: ubuntu-24.04 steps: - - uses: actions/create-github-app-token@v1 + - name: create github app token + if: github.event.pull_request.head.repo.fork == false + uses: actions/create-github-app-token@v1 id: app-token with: app-id: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_APP_ID }} private-key: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_PRIVATE_KEY }} - name: Import GPG key + if: github.event.pull_request.head.repo.fork == false uses: crazy-max/ghaction-import-gpg@v6 id: import_gpg with: @@ -72,7 +75,8 @@ jobs: - uses: actions/checkout@v4 - - name: GoLangCI-Lint + - name: GoLangCI-Lint-Repo + if: github.event.pull_request.head.repo.fork == false uses: reviewdog/action-golangci-lint@v2 with: github_token: ${{ steps.app-token.outputs.token }} @@ -90,6 +94,19 @@ jobs: GIT_COMMITTER_NAME: ${{ secrets.LERIAN_CI_CD_USER_NAME }} GIT_COMMITTER_EMAIL: ${{ secrets.LERIAN_CI_CD_USER_EMAIL }} + - name: GoLangCI-Setup-Go-fork + if: github.event.pull_request.head.repo.fork == true + uses: actions/setup-go@v5 + with: + go-version: '1.21' + cache: false + + - name: GoLangCI-Lint-fork + if: github.event.pull_request.head.repo.fork == true + uses: golangci/golangci-lint-action@v4 + with: + version: latest + GoSec: name: Run GoSec to Midaz runs-on: ubuntu-24.04 From fe3e296796339d2c07debd9bf653a1dc21c8c252 Mon Sep 17 00:00:00 2001 From: marianalopes Date: Wed, 29 Jan 2025 10:31:45 +0100 Subject: [PATCH 12/12] fix: rollback first change --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index f6c8d5c5..94208e4d 100644 --- a/Makefile +++ b/Makefile @@ -160,6 +160,15 @@ set-env: cp -r $(AUDIT_DIR)/.env.example $(AUDIT_DIR)/.env @echo "$(BLUE)Environment files created successfully$(NC)" +.PHONY: up +up: + @echo "$(BLUE)Starting all services...$(NC)" + @$(DOCKER_CMD) -f $(AUTH_DIR)/docker-compose.yml up --build -d + @$(DOCKER_CMD) -f $(INFRA_DIR)/docker-compose.yml up --build -d + @$(DOCKER_CMD) -f $(LEDGER_DIR)/docker-compose.yml up --build -d + @$(DOCKER_CMD) -f $(TRANSACTION_DIR)/docker-compose.yml up --build -d + @echo "$(BLUE)All services started successfully$(NC)" + .PHONY: auth auth: @echo "$(BLUE)Executing command in auth service...$(NC)" @@ -185,15 +194,6 @@ audit: @echo "$(BLUE)Executing command in audit service...$(NC)" $(MAKE) -C $(AUDIT_DIR) $(COMMAND) -.PHONY: up -up: - @echo "$(BLUE)Starting all services...$(NC)" - @$(DOCKER_CMD) -f $(AUTH_DIR)/docker-compose.yml up --build -d - @$(DOCKER_CMD) -f $(INFRA_DIR)/docker-compose.yml up --build -d - @$(DOCKER_CMD) -f $(LEDGER_DIR)/docker-compose.yml up --build -d - @$(DOCKER_CMD) -f $(TRANSACTION_DIR)/docker-compose.yml up --build -d - @echo "$(BLUE)All services started successfully$(NC)" - .PHONY: all-services all-services: @echo "$(BLUE)Executing command across all services...$(NC)"