From 10d1a898792d3dd6aa4a0b5a03188d408ae831f7 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 10:28:41 +0200 Subject: [PATCH 01/31] replaces 'return' to 'continue' so we iterate all the PRs even if we encounter a PR we should not scan --- scanpullrequest/scanallpullrequests.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scanpullrequest/scanallpullrequests.go b/scanpullrequest/scanallpullrequests.go index 8b16842f3..8d52d966f 100644 --- a/scanpullrequest/scanallpullrequests.go +++ b/scanpullrequest/scanallpullrequests.go @@ -47,7 +47,7 @@ func scanAllPullRequests(repo utils.Repository, client vcsclient.VcsClient) (err } if !shouldScan { log.Info("Pull Request", pr.ID, "has already been scanned before. If you wish to scan it again, please comment \"rescan\".") - return + continue } repo.PullRequestDetails = pr if e = scanPullRequest(&repo, client); e != nil { From 93a99d08a7a28ea754737e4e3954d6d88e98bb77 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 10:28:41 +0200 Subject: [PATCH 02/31] cherry pick mistaken commit to dev --- scanpullrequest/scanallpullrequests.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scanpullrequest/scanallpullrequests.go b/scanpullrequest/scanallpullrequests.go index 8d52d966f..8b16842f3 100644 --- a/scanpullrequest/scanallpullrequests.go +++ b/scanpullrequest/scanallpullrequests.go @@ -47,7 +47,7 @@ func scanAllPullRequests(repo utils.Repository, client vcsclient.VcsClient) (err } if !shouldScan { log.Info("Pull Request", pr.ID, "has already been scanned before. If you wish to scan it again, please comment \"rescan\".") - continue + return } repo.PullRequestDetails = pr if e = scanPullRequest(&repo, client); e != nil { From 73f9b8f581cfdc46bae4bb34e05a2749399f5219 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 14:30:03 +0200 Subject: [PATCH 03/31] Adding a new trigger for Frogbot tests --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a764a729..eae55f68c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,10 +2,13 @@ name: "Go Tests" on: push: - # Triggers the workflow on labeled PRs only. + # Triggers the workflow on labeled PRs. pull_request_target: types: [labeled] + # Trigger the workflow on-demand from the 'Actions' tab + workflow_dispatch: + # Ensures that only the latest commit is running for each PR at a time. # Ignores this rule for push events. concurrency: From 4cb86bdd85651b1cbd2a296632e3c29cf5185ba1 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 14:52:49 +0200 Subject: [PATCH 04/31] . --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eae55f68c..02f3ae24e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,9 +6,6 @@ on: pull_request_target: types: [labeled] - # Trigger the workflow on-demand from the 'Actions' tab - workflow_dispatch: - # Ensures that only the latest commit is running for each PR at a time. # Ignores this rule for push events. concurrency: From 4d64e2ec7cd93bb14c34c108d3c2402b61eed6c9 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 15:02:57 +0200 Subject: [PATCH 05/31] added new workflow for on-demand trigger --- .github/workflows/test-before-release.yml | 206 ++++++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100644 .github/workflows/test-before-release.yml diff --git a/.github/workflows/test-before-release.yml b/.github/workflows/test-before-release.yml new file mode 100644 index 000000000..9ec974c3e --- /dev/null +++ b/.github/workflows/test-before-release.yml @@ -0,0 +1,206 @@ +name: "Go Tests" + +on: + push: + # Triggers the workflow on-demand from the 'Actions' tab. + workflow_dispatch: + +# Ensures that only the latest commit is running for each PR at a time. +# Ignores this rule for push events. +concurrency: + group: ${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true +jobs: + Pretest: + if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push' + runs-on: ubuntu-latest + steps: + - name: Unlabel 'safe to test' + uses: actions-ecosystem/action-remove-labels@v1 + if: ${{ github.event_name != 'push' }} + with: + labels: "safe to test" + + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: 1.21.x + + - name: Go Cache + uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go- + + # Generate mocks + - name: Generate mocks + run: go generate ./... + + - name: Lint + run: go vet -v ./... + + tests: + needs: Pretest + name: ${{ matrix.suite.name }} Tests (${{ matrix.os }}) + runs-on: ${{ matrix.os }}-latest + env: + JFROG_CLI_LOG_LEVEL: "DEBUG" + GRADLE_OPTS: -Dorg.gradle.daemon=false + strategy: + fail-fast: false + matrix: + suite: + - name: 'Unit' + + - name: 'Scan Repository' + package: 'scanrepository' + + - name: 'Scan Pull Request' + package: 'scanpullrequest' + + - name: 'Package Handlers' + package: 'packagehandlers' + + os: [ ubuntu, windows, macos ] + steps: + # Configure prerequisites + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.21.x + + - name: Go Cache + uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Install npm + uses: actions/setup-node@v3 + with: + node-version: "16" + + - name: Setup Python3 + uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - name: Install python components + run: python -m pip install pipenv poetry + + - name: Install dotnet + uses: actions/setup-dotnet@v3 + with: + dotnet-version: "6.x" + + # Generate mocks + - name: Generate mocks + run: go generate ./... + if: ${{ matrix.suite.name != 'Unit' }} + + - name: Run Tests + if: ${{ matrix.suite.name != 'GitHub Integration' || matrix.os == 'ubuntu' }} + run: go test github.com/jfrog/frogbot/v2/${{ matrix.suite.package }} -v -race -timeout 30m -cover + env: + JF_URL: ${{ secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + + github-integration: + name: GitHub Integration Tests + needs: Pretest + runs-on: ubuntu-latest + env: + JFROG_CLI_LOG_LEVEL: "DEBUG" + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Run Tests + run: go test github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover + env: + JF_URL: ${{ secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }} + + azure-integration: + name: Azure Integration Tests + needs: Pretest + runs-on: ${{ matrix.os }}-latest + strategy: + fail-fast: false + matrix: + os: [ ubuntu, windows, macos ] + env: + JFROG_CLI_LOG_LEVEL: "DEBUG" + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Run Tests + run: go test azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover + env: + JF_URL: ${{ secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_TESTS_AZURE_TOKEN }} + + gitlab-integration: + name: GitLab Integration Tests + needs: Pretest + runs-on: ${{ matrix.os }}-latest + strategy: + fail-fast: false + matrix: + os: [ ubuntu, windows, macos ] + env: + JFROG_CLI_LOG_LEVEL: "DEBUG" + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Run Tests + run: go test gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover + env: + JF_URL: ${{ secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + FROGBOT_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITLAB_TOKEN }} + + bitbucket-server-integration: + name: Bitbucket Server Integration Tests + needs: Pretest + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Unzip Preconfigured Bitbucket Home + run: unzip ${{ github.workspace }}/testdata/resources/bitbucket_server_home.zip -d ${PWD} + + - name: Download Bitbucket Server and Run + run: | + bb_script_path="${{ github.workspace }}/testdata/resources/bitbucket_server_run.sh" + chmod +x $bb_script_path + sh $bb_script_path + + - name: Run Tests + env: + JF_URL: ${{ secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_TESTS_BB_SERVER_TOKEN }} + JFROG_CLI_LOG_LEVEL: "DEBUG" + run: go test -v bitbucket_server_test.go commands.go integrationutils.go \ No newline at end of file From db764bb5532b3090200642782c1eb64d75a8f3b0 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 15:24:10 +0200 Subject: [PATCH 06/31] changed credentials names so we can add new credentials to dev-master Artifactory --- .github/workflows/test-before-release.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-before-release.yml b/.github/workflows/test-before-release.yml index 9ec974c3e..9f66ef015 100644 --- a/.github/workflows/test-before-release.yml +++ b/.github/workflows/test-before-release.yml @@ -12,15 +12,8 @@ concurrency: cancel-in-progress: true jobs: Pretest: - if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push' runs-on: ubuntu-latest steps: - - name: Unlabel 'safe to test' - uses: actions-ecosystem/action-remove-labels@v1 - if: ${{ github.event_name != 'push' }} - with: - labels: "safe to test" - - name: Checkout code uses: actions/checkout@v4 with: @@ -131,8 +124,8 @@ jobs: - name: Run Tests run: go test github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: - JF_URL: ${{ secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + JF_URL: ${{ secrets.DEV_MASTER_PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }} azure-integration: @@ -153,8 +146,8 @@ jobs: - name: Run Tests run: go test azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: - JF_URL: ${{ secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + JF_URL: ${{ secrets.DEV_MASTER_PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_TESTS_AZURE_TOKEN }} gitlab-integration: @@ -175,8 +168,8 @@ jobs: - name: Run Tests run: go test gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: - JF_URL: ${{ secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + JF_URL: ${{ secrets.DEV_MASTER_PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITLAB_TOKEN }} bitbucket-server-integration: @@ -199,8 +192,8 @@ jobs: - name: Run Tests env: - JF_URL: ${{ secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + JF_URL: ${{ secrets.DEV_MASTER_PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_TESTS_BB_SERVER_TOKEN }} JFROG_CLI_LOG_LEVEL: "DEBUG" run: go test -v bitbucket_server_test.go commands.go integrationutils.go \ No newline at end of file From 4c67c46bc9feb29a2c1619e591c883c84337953d Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 15:24:42 +0200 Subject: [PATCH 07/31] . --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 02f3ae24e..9a764a729 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: "Go Tests" on: push: - # Triggers the workflow on labeled PRs. + # Triggers the workflow on labeled PRs only. pull_request_target: types: [labeled] From 27498aa47cf6e14e4d0678f61842f5d18a111f3e Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 15:39:23 +0200 Subject: [PATCH 08/31] . --- .github/workflows/test-before-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-before-release.yml b/.github/workflows/test-before-release.yml index 9f66ef015..cbce7e081 100644 --- a/.github/workflows/test-before-release.yml +++ b/.github/workflows/test-before-release.yml @@ -1,7 +1,6 @@ name: "Go Tests" on: - push: # Triggers the workflow on-demand from the 'Actions' tab. workflow_dispatch: From 4203c08ce17c86d00919c9f412c47285d866e59b Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 15:51:41 +0200 Subject: [PATCH 09/31] . --- .github/workflows/test-before-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-before-release.yml b/.github/workflows/test-before-release.yml index cbce7e081..2d02b7118 100644 --- a/.github/workflows/test-before-release.yml +++ b/.github/workflows/test-before-release.yml @@ -1,4 +1,4 @@ -name: "Go Tests" +name: "Go Tests Pre Release Env" on: # Triggers the workflow on-demand from the 'Actions' tab. From cce49ab5eeeebe43e70ebc428c407fa852fc3818 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 17:13:10 +0200 Subject: [PATCH 10/31] . --- .github/workflows/test-before-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-before-release.yml b/.github/workflows/test-before-release.yml index 2d02b7118..8816b6529 100644 --- a/.github/workflows/test-before-release.yml +++ b/.github/workflows/test-before-release.yml @@ -106,8 +106,8 @@ jobs: if: ${{ matrix.suite.name != 'GitHub Integration' || matrix.os == 'ubuntu' }} run: go test github.com/jfrog/frogbot/v2/${{ matrix.suite.package }} -v -race -timeout 30m -cover env: - JF_URL: ${{ secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + JF_URL: ${{ secrets.DEV_MASTER_PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }} github-integration: name: GitHub Integration Tests From 1e2045a251485c6f14fbb7dfe0bc64c4f722162e Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 12 Mar 2024 17:41:58 +0200 Subject: [PATCH 11/31] new workflow file to enable triggering Frogbot's tests against dev-master --- .github/workflows/test-before-release.yml | 4 +++- .github/workflows/test.yml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-before-release.yml b/.github/workflows/test-before-release.yml index 8816b6529..f5c08960b 100644 --- a/.github/workflows/test-before-release.yml +++ b/.github/workflows/test-before-release.yml @@ -1,4 +1,6 @@ -name: "Go Tests Pre Release Env" +# This workflow resembles test.yml but can be manually triggered. +# Operating against the dev-master server, which incorporates the latest Xray code changes, and allowing us to test compatibility and ensure that our code remains unaffected by recent Xray updates before their official release. +name: "Go Tests: Dev-Master env" on: # Triggers the workflow on-demand from the 'Actions' tab. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a764a729..e4abb9490 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,4 @@ +# NOTE: If any modifications are made to this workflow file, please remember to review the test-before-release.yml file and make corresponding updates. name: "Go Tests" on: From c112a62076c2b07a01a96eb59320c4dfb61d056a Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 13 Mar 2024 11:46:12 +0200 Subject: [PATCH 12/31] attempt to unify workflow files --- .github/workflows/test.yml | 52 ++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4abb9490..28c721c18 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: true jobs: Pretest: - if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push' + if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: - name: Unlabel 'safe to test' @@ -47,8 +47,28 @@ jobs: - name: Lint run: go vet -v ./... - tests: + resolve-credentials: needs: Pretest + runs-on: ubuntu-latest + outputs: + resolved-jf-url: ${{ steps.resolve.outputs.resolved-jf-url }} + resolved-jf-access-token: ${{ steps.resolve.outputs.resolved-jf-access-token }} + steps: + - name: Resolve Credentials + id: resolve + run: | + if [ "${{ github.event_name }}" = "push" ]; then + echo "Working in Production environment." + echo "::set-output name=resolved-jf-url::${{ secrets.PLATFORM_URL }}" + echo "::set-output name=resolved-jf-access-token::${{ secrets.PLATFORM_ADMIN_TOKEN }}" + elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "Working in the dev-master environment." + echo "::set-output name=resolved-jf-url::${{ secrets.DEV_MASTER_PLATFORM_URL }}" + echo "::set-output name=resolved-jf-access-token::${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }}" + fi + + tests: + needs: [Pretest, resolve-credentials] name: ${{ matrix.suite.name }} Tests (${{ matrix.os }}) runs-on: ${{ matrix.os }}-latest env: @@ -116,12 +136,12 @@ jobs: if: ${{ matrix.suite.name != 'GitHub Integration' || matrix.os == 'ubuntu' }} run: go test github.com/jfrog/frogbot/v2/${{ matrix.suite.package }} -v -race -timeout 30m -cover env: - JF_URL: ${{ secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + JF_URL: ${{ needs.resolve-credentials.outputs.resolved-jf-url }} + JF_ACCESS_TOKEN: ${{ needs.resolve-credentials.outputs.resolved-jf-access-token }} github-integration: name: GitHub Integration Tests - needs: Pretest + needs: [Pretest, resolve-credentials] runs-on: ubuntu-latest env: JFROG_CLI_LOG_LEVEL: "DEBUG" @@ -133,13 +153,13 @@ jobs: - name: Run Tests run: go test github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: - JF_URL: ${{ secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + JF_URL: ${{ needs.resolve-credentials.outputs.resolved-jf-url }} + JF_ACCESS_TOKEN: ${{ needs.resolve-credentials.outputs.resolved-jf-access-token }} FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }} azure-integration: name: Azure Integration Tests - needs: Pretest + needs: [Pretest, resolve-credentials] runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false @@ -155,13 +175,13 @@ jobs: - name: Run Tests run: go test azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: - JF_URL: ${{ secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + JF_URL: ${{ needs.resolve-credentials.outputs.resolved-jf-url }} + JF_ACCESS_TOKEN: ${{ needs.resolve-credentials.outputs.resolved-jf-access-token }} FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_TESTS_AZURE_TOKEN }} gitlab-integration: name: GitLab Integration Tests - needs: Pretest + needs: [Pretest, resolve-credentials] runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false @@ -177,13 +197,13 @@ jobs: - name: Run Tests run: go test gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: - JF_URL: ${{ secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + JF_URL: ${{ needs.resolve-credentials.outputs.resolved-jf-url }} + JF_ACCESS_TOKEN: ${{ needs.resolve-credentials.outputs.resolved-jf-access-token }} FROGBOT_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITLAB_TOKEN }} bitbucket-server-integration: name: Bitbucket Server Integration Tests - needs: Pretest + needs: [Pretest, resolve-credentials] runs-on: macos-latest steps: - uses: actions/checkout@v4 @@ -201,8 +221,8 @@ jobs: - name: Run Tests env: - JF_URL: ${{ secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} + JF_URL: ${{ needs.resolve-credentials.outputs.resolved-jf-url }} + JF_ACCESS_TOKEN: ${{ needs.resolve-credentials.outputs.resolved-jf-access-token }} FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_TESTS_BB_SERVER_TOKEN }} JFROG_CLI_LOG_LEVEL: "DEBUG" run: go test -v bitbucket_server_test.go commands.go integrationutils.go \ No newline at end of file From 88ef8400bf1d5497d928d8574b191f6951c367cc Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 13 Mar 2024 11:48:07 +0200 Subject: [PATCH 13/31] attempt to unify workflow files --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 28c721c18..79e14a5d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,8 @@ on: pull_request_target: types: [labeled] + workflow_dispatch: + # Ensures that only the latest commit is running for each PR at a time. # Ignores this rule for push events. concurrency: From b5b91bc8ca18410791a71810f59865183a027d77 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 13 Mar 2024 14:20:06 +0200 Subject: [PATCH 14/31] attempt to unify workflow files 2 --- .github/workflows/test.yml | 50 ++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 79e14a5d3..d9c34001c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,14 @@ jobs: with: labels: "safe to test" + - name: Declare running environment + run: | + if [ "${{ github.event_name }}" = "push" ]; then + echo "Working in Production environment." + elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "Working in the dev-master environment." + fi + - name: Checkout code uses: actions/checkout@v4 with: @@ -49,25 +57,25 @@ jobs: - name: Lint run: go vet -v ./... - resolve-credentials: - needs: Pretest - runs-on: ubuntu-latest - outputs: - resolved-jf-url: ${{ steps.resolve.outputs.resolved-jf-url }} - resolved-jf-access-token: ${{ steps.resolve.outputs.resolved-jf-access-token }} - steps: - - name: Resolve Credentials - id: resolve - run: | - if [ "${{ github.event_name }}" = "push" ]; then - echo "Working in Production environment." - echo "::set-output name=resolved-jf-url::${{ secrets.PLATFORM_URL }}" - echo "::set-output name=resolved-jf-access-token::${{ secrets.PLATFORM_ADMIN_TOKEN }}" - elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - echo "Working in the dev-master environment." - echo "::set-output name=resolved-jf-url::${{ secrets.DEV_MASTER_PLATFORM_URL }}" - echo "::set-output name=resolved-jf-access-token::${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }}" - fi + #resolve-credentials: + # needs: Pretest + # runs-on: ubuntu-latest + # outputs: + # resolved-jf-url: ${{ steps.resolve.outputs.resolved-jf-url }} + # resolved-jf-access-token: ${{ steps.resolve.outputs.resolved-jf-access-token }} + # steps: + # - name: Resolve Credentials + # id: resolve + # run: | + # if [ "${{ github.event_name }}" = "push" ]; then + # echo "Working in Production environment." + # echo "::set-output name=resolved-jf-url::${{ secrets.PLATFORM_URL }}" + # echo "::set-output name=resolved-jf-access-token::${{ secrets.PLATFORM_ADMIN_TOKEN }}" + # elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + # echo "Working in the dev-master environment." + # echo "::set-output name=resolved-jf-url::${{ secrets.DEV_MASTER_PLATFORM_URL }}" + # echo "::set-output name=resolved-jf-access-token::${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }}" + # fi tests: needs: [Pretest, resolve-credentials] @@ -138,8 +146,8 @@ jobs: if: ${{ matrix.suite.name != 'GitHub Integration' || matrix.os == 'ubuntu' }} run: go test github.com/jfrog/frogbot/v2/${{ matrix.suite.package }} -v -race -timeout 30m -cover env: - JF_URL: ${{ needs.resolve-credentials.outputs.resolved-jf-url }} - JF_ACCESS_TOKEN: ${{ needs.resolve-credentials.outputs.resolved-jf-access-token }} + JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} github-integration: name: GitHub Integration Tests From 0d04af292d81b4d5a5597061020eaa20ca17bd0e Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 13 Mar 2024 14:24:22 +0200 Subject: [PATCH 15/31] attempt to unify workflow files 3 --- .github/workflows/test.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d9c34001c..419eaef63 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -78,7 +78,7 @@ jobs: # fi tests: - needs: [Pretest, resolve-credentials] + needs: Pretest name: ${{ matrix.suite.name }} Tests (${{ matrix.os }}) runs-on: ${{ matrix.os }}-latest env: @@ -151,7 +151,7 @@ jobs: github-integration: name: GitHub Integration Tests - needs: [Pretest, resolve-credentials] + needs: Pretest runs-on: ubuntu-latest env: JFROG_CLI_LOG_LEVEL: "DEBUG" @@ -163,13 +163,13 @@ jobs: - name: Run Tests run: go test github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: - JF_URL: ${{ needs.resolve-credentials.outputs.resolved-jf-url }} - JF_ACCESS_TOKEN: ${{ needs.resolve-credentials.outputs.resolved-jf-access-token }} + JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }} azure-integration: name: Azure Integration Tests - needs: [Pretest, resolve-credentials] + needs: Pretest runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false @@ -185,13 +185,13 @@ jobs: - name: Run Tests run: go test azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: - JF_URL: ${{ needs.resolve-credentials.outputs.resolved-jf-url }} - JF_ACCESS_TOKEN: ${{ needs.resolve-credentials.outputs.resolved-jf-access-token }} + JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_TESTS_AZURE_TOKEN }} gitlab-integration: name: GitLab Integration Tests - needs: [Pretest, resolve-credentials] + needs: Pretest runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false @@ -207,13 +207,13 @@ jobs: - name: Run Tests run: go test gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: - JF_URL: ${{ needs.resolve-credentials.outputs.resolved-jf-url }} - JF_ACCESS_TOKEN: ${{ needs.resolve-credentials.outputs.resolved-jf-access-token }} + JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} FROGBOT_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITLAB_TOKEN }} bitbucket-server-integration: name: Bitbucket Server Integration Tests - needs: [Pretest, resolve-credentials] + needs: Pretest runs-on: macos-latest steps: - uses: actions/checkout@v4 @@ -231,8 +231,8 @@ jobs: - name: Run Tests env: - JF_URL: ${{ needs.resolve-credentials.outputs.resolved-jf-url }} - JF_ACCESS_TOKEN: ${{ needs.resolve-credentials.outputs.resolved-jf-access-token }} + JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_TESTS_BB_SERVER_TOKEN }} JFROG_CLI_LOG_LEVEL: "DEBUG" run: go test -v bitbucket_server_test.go commands.go integrationutils.go \ No newline at end of file From 4f8b9ce5a8023c0bb156fd04346a682a68adafad Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 13 Mar 2024 14:47:53 +0200 Subject: [PATCH 16/31] ready to review --- .github/workflows/test-before-release.yml | 200 ---------------------- .github/workflows/test.yml | 33 +--- 2 files changed, 7 insertions(+), 226 deletions(-) delete mode 100644 .github/workflows/test-before-release.yml diff --git a/.github/workflows/test-before-release.yml b/.github/workflows/test-before-release.yml deleted file mode 100644 index f5c08960b..000000000 --- a/.github/workflows/test-before-release.yml +++ /dev/null @@ -1,200 +0,0 @@ -# This workflow resembles test.yml but can be manually triggered. -# Operating against the dev-master server, which incorporates the latest Xray code changes, and allowing us to test compatibility and ensure that our code remains unaffected by recent Xray updates before their official release. -name: "Go Tests: Dev-Master env" - -on: - # Triggers the workflow on-demand from the 'Actions' tab. - workflow_dispatch: - -# Ensures that only the latest commit is running for each PR at a time. -# Ignores this rule for push events. -concurrency: - group: ${{ github.event.pull_request.number || github.sha }} - cancel-in-progress: true -jobs: - Pretest: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Install Go - uses: actions/setup-go@v3 - with: - go-version: 1.21.x - - - name: Go Cache - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: ${{ runner.os }}-go- - - # Generate mocks - - name: Generate mocks - run: go generate ./... - - - name: Lint - run: go vet -v ./... - - tests: - needs: Pretest - name: ${{ matrix.suite.name }} Tests (${{ matrix.os }}) - runs-on: ${{ matrix.os }}-latest - env: - JFROG_CLI_LOG_LEVEL: "DEBUG" - GRADLE_OPTS: -Dorg.gradle.daemon=false - strategy: - fail-fast: false - matrix: - suite: - - name: 'Unit' - - - name: 'Scan Repository' - package: 'scanrepository' - - - name: 'Scan Pull Request' - package: 'scanpullrequest' - - - name: 'Package Handlers' - package: 'packagehandlers' - - os: [ ubuntu, windows, macos ] - steps: - # Configure prerequisites - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: 1.21.x - - - name: Go Cache - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Install npm - uses: actions/setup-node@v3 - with: - node-version: "16" - - - name: Setup Python3 - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: Install python components - run: python -m pip install pipenv poetry - - - name: Install dotnet - uses: actions/setup-dotnet@v3 - with: - dotnet-version: "6.x" - - # Generate mocks - - name: Generate mocks - run: go generate ./... - if: ${{ matrix.suite.name != 'Unit' }} - - - name: Run Tests - if: ${{ matrix.suite.name != 'GitHub Integration' || matrix.os == 'ubuntu' }} - run: go test github.com/jfrog/frogbot/v2/${{ matrix.suite.package }} -v -race -timeout 30m -cover - env: - JF_URL: ${{ secrets.DEV_MASTER_PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }} - - github-integration: - name: GitHub Integration Tests - needs: Pretest - runs-on: ubuntu-latest - env: - JFROG_CLI_LOG_LEVEL: "DEBUG" - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Run Tests - run: go test github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover - env: - JF_URL: ${{ secrets.DEV_MASTER_PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }} - FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }} - - azure-integration: - name: Azure Integration Tests - needs: Pretest - runs-on: ${{ matrix.os }}-latest - strategy: - fail-fast: false - matrix: - os: [ ubuntu, windows, macos ] - env: - JFROG_CLI_LOG_LEVEL: "DEBUG" - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Run Tests - run: go test azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover - env: - JF_URL: ${{ secrets.DEV_MASTER_PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }} - FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_TESTS_AZURE_TOKEN }} - - gitlab-integration: - name: GitLab Integration Tests - needs: Pretest - runs-on: ${{ matrix.os }}-latest - strategy: - fail-fast: false - matrix: - os: [ ubuntu, windows, macos ] - env: - JFROG_CLI_LOG_LEVEL: "DEBUG" - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Run Tests - run: go test gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover - env: - JF_URL: ${{ secrets.DEV_MASTER_PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }} - FROGBOT_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITLAB_TOKEN }} - - bitbucket-server-integration: - name: Bitbucket Server Integration Tests - needs: Pretest - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Unzip Preconfigured Bitbucket Home - run: unzip ${{ github.workspace }}/testdata/resources/bitbucket_server_home.zip -d ${PWD} - - - name: Download Bitbucket Server and Run - run: | - bb_script_path="${{ github.workspace }}/testdata/resources/bitbucket_server_run.sh" - chmod +x $bb_script_path - sh $bb_script_path - - - name: Run Tests - env: - JF_URL: ${{ secrets.DEV_MASTER_PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }} - FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_TESTS_BB_SERVER_TOKEN }} - JFROG_CLI_LOG_LEVEL: "DEBUG" - run: go test -v bitbucket_server_test.go commands.go integrationutils.go \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 419eaef63..60d887b39 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,3 @@ -# NOTE: If any modifications are made to this workflow file, please remember to review the test-before-release.yml file and make corresponding updates. name: "Go Tests" on: @@ -57,26 +56,6 @@ jobs: - name: Lint run: go vet -v ./... - #resolve-credentials: - # needs: Pretest - # runs-on: ubuntu-latest - # outputs: - # resolved-jf-url: ${{ steps.resolve.outputs.resolved-jf-url }} - # resolved-jf-access-token: ${{ steps.resolve.outputs.resolved-jf-access-token }} - # steps: - # - name: Resolve Credentials - # id: resolve - # run: | - # if [ "${{ github.event_name }}" = "push" ]; then - # echo "Working in Production environment." - # echo "::set-output name=resolved-jf-url::${{ secrets.PLATFORM_URL }}" - # echo "::set-output name=resolved-jf-access-token::${{ secrets.PLATFORM_ADMIN_TOKEN }}" - # elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - # echo "Working in the dev-master environment." - # echo "::set-output name=resolved-jf-url::${{ secrets.DEV_MASTER_PLATFORM_URL }}" - # echo "::set-output name=resolved-jf-access-token::${{ secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN }}" - # fi - tests: needs: Pretest name: ${{ matrix.suite.name }} Tests (${{ matrix.os }}) @@ -147,7 +126,7 @@ jobs: run: go test github.com/jfrog/frogbot/v2/${{ matrix.suite.package }} -v -race -timeout 30m -cover env: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} github-integration: name: GitHub Integration Tests @@ -163,8 +142,10 @@ jobs: - name: Run Tests run: go test github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: + # If the action is triggered by 'workflow_dispatch' the credentials are: DEV_MASTER_PLATFORM_URL & DEV_MASTER_PLATFORM_ADMIN_TOKEN + # If the action is triggered by a 'push' event the credentials are: PLATFORM_URL & PLATFORM_ADMIN_TOKEN JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }} azure-integration: @@ -186,7 +167,7 @@ jobs: run: go test azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_TESTS_AZURE_TOKEN }} gitlab-integration: @@ -208,7 +189,7 @@ jobs: run: go test gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITLAB_TOKEN }} bitbucket-server-integration: @@ -232,7 +213,7 @@ jobs: - name: Run Tests env: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_TESTS_BB_SERVER_TOKEN }} JFROG_CLI_LOG_LEVEL: "DEBUG" run: go test -v bitbucket_server_test.go commands.go integrationutils.go \ No newline at end of file From 17642354b87f0f95e5b23be01db5cb768b50f44e Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 13 Mar 2024 14:50:48 +0200 Subject: [PATCH 17/31] minor fix --- .github/workflows/test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60d887b39..1660885ce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -126,7 +126,7 @@ jobs: run: go test github.com/jfrog/frogbot/v2/${{ matrix.suite.package }} -v -race -timeout 30m -cover env: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} github-integration: name: GitHub Integration Tests @@ -145,7 +145,7 @@ jobs: # If the action is triggered by 'workflow_dispatch' the credentials are: DEV_MASTER_PLATFORM_URL & DEV_MASTER_PLATFORM_ADMIN_TOKEN # If the action is triggered by a 'push' event the credentials are: PLATFORM_URL & PLATFORM_ADMIN_TOKEN JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }} azure-integration: @@ -167,7 +167,7 @@ jobs: run: go test azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_TESTS_AZURE_TOKEN }} gitlab-integration: @@ -189,7 +189,7 @@ jobs: run: go test gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITLAB_TOKEN }} bitbucket-server-integration: @@ -213,7 +213,7 @@ jobs: - name: Run Tests env: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} + JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_TESTS_BB_SERVER_TOKEN }} JFROG_CLI_LOG_LEVEL: "DEBUG" run: go test -v bitbucket_server_test.go commands.go integrationutils.go \ No newline at end of file From 4fae52fbce77217d7a7a986540ed2dd19e6b81c3 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Mon, 18 Mar 2024 13:39:33 +0200 Subject: [PATCH 18/31] fix comment --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60d887b39..318630f57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -143,7 +143,7 @@ jobs: run: go test github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover env: # If the action is triggered by 'workflow_dispatch' the credentials are: DEV_MASTER_PLATFORM_URL & DEV_MASTER_PLATFORM_ADMIN_TOKEN - # If the action is triggered by a 'push' event the credentials are: PLATFORM_URL & PLATFORM_ADMIN_TOKEN + # If the action is triggered by a 'pull request' event the credentials are: PLATFORM_URL & PLATFORM_ADMIN_TOKEN JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }} From ce2792c2e29236433e5cefaecd1547b3055204cf Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Mon, 18 Mar 2024 13:51:36 +0200 Subject: [PATCH 19/31] minor changes --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1d9c1ac56..bfb321035 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,12 +24,12 @@ jobs: with: labels: "safe to test" - - name: Declare running environment + - name: Declare environment run: | if [ "${{ github.event_name }}" = "push" ]; then - echo "Working in Production environment." + echo "Working in production environment." elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - echo "Working in the dev-master environment." + echo "Working in dev-master environment." fi - name: Checkout code From 640c2b5422b38ad002542fd262bb4ceba0068651 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 26 Mar 2024 18:20:21 +0200 Subject: [PATCH 20/31] temporary print the value --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bfb321035..91b629f70 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -128,6 +128,10 @@ jobs: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} + - name: Print ENV + run: | + echo "The value is: $JF_URL" + github-integration: name: GitHub Integration Tests needs: Pretest From 1da358d4ed79d0ab623f2b2744405b1d3be6118e Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 26 Mar 2024 18:35:24 +0200 Subject: [PATCH 21/31] temporary print values --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 91b629f70..388666cf0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -130,7 +130,10 @@ jobs: - name: Print ENV run: | - echo "The value is: $JF_URL" + echo "PLATFORM_URL value is: ${{ github.event_name }} + echo "DEV_MASTER_PLATFORM_URL value is: ${{ secrets.DEV_MASTER_PLATFORM_URL }} + echo "final JF_URL value is: $JF_URL" + echo "event name is: ${{ github.event_name }} github-integration: name: GitHub Integration Tests From 6ad95a1cfc465e2992f90e470751b58067831750 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 26 Mar 2024 18:41:56 +0200 Subject: [PATCH 22/31] temporary print values 2 --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 388666cf0..4e04757b0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -130,10 +130,10 @@ jobs: - name: Print ENV run: | - echo "PLATFORM_URL value is: ${{ github.event_name }} + echo "event name is: ${{ github.event_name }}" + echo "PLATFORM_URL value is: ${{ github.PLATFORM_URL }} echo "DEV_MASTER_PLATFORM_URL value is: ${{ secrets.DEV_MASTER_PLATFORM_URL }} echo "final JF_URL value is: $JF_URL" - echo "event name is: ${{ github.event_name }} github-integration: name: GitHub Integration Tests From dddb5e1c7a7217a0542a0cfaba9a38fdc1dbc4b5 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 26 Mar 2024 18:58:51 +0200 Subject: [PATCH 23/31] temporary print values 3 --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e04757b0..ff8e52eb2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -134,6 +134,7 @@ jobs: echo "PLATFORM_URL value is: ${{ github.PLATFORM_URL }} echo "DEV_MASTER_PLATFORM_URL value is: ${{ secrets.DEV_MASTER_PLATFORM_URL }} echo "final JF_URL value is: $JF_URL" + echo "a change for push" github-integration: name: GitHub Integration Tests From 8c3bd572a9f6e5789f7dc3726a3c017a20ff03ea Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Tue, 26 Mar 2024 19:03:57 +0200 Subject: [PATCH 24/31] temporary print values 4 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff8e52eb2..6a5263f5c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -131,7 +131,7 @@ jobs: - name: Print ENV run: | echo "event name is: ${{ github.event_name }}" - echo "PLATFORM_URL value is: ${{ github.PLATFORM_URL }} + echo "PLATFORM_URL value is: ${{ secrets.PLATFORM_URL }} echo "DEV_MASTER_PLATFORM_URL value is: ${{ secrets.DEV_MASTER_PLATFORM_URL }} echo "final JF_URL value is: $JF_URL" echo "a change for push" From e78318a6232c1ce45935cc2c94f9dca44d4bb2eb Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 27 Mar 2024 09:57:24 +0200 Subject: [PATCH 25/31] temporary print values 5 --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6a5263f5c..4c37d2ed4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -129,6 +129,8 @@ jobs: JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} - name: Print ENV + env: + JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} run: | echo "event name is: ${{ github.event_name }}" echo "PLATFORM_URL value is: ${{ secrets.PLATFORM_URL }} From 33a20670429fb44a1890ce37bfb2d9764bd4cd61 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 27 Mar 2024 10:22:25 +0200 Subject: [PATCH 26/31] temporary print values 6 --- .github/workflows/test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4c37d2ed4..f9fe2eb10 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -133,10 +133,9 @@ jobs: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} run: | echo "event name is: ${{ github.event_name }}" - echo "PLATFORM_URL value is: ${{ secrets.PLATFORM_URL }} - echo "DEV_MASTER_PLATFORM_URL value is: ${{ secrets.DEV_MASTER_PLATFORM_URL }} + echo "PLATFORM_URL value is: ${{ secrets.PLATFORM_URL }}" + echo "DEV_MASTER_PLATFORM_URL value is: ${{ secrets.DEV_MASTER_PLATFORM_URL }}" echo "final JF_URL value is: $JF_URL" - echo "a change for push" github-integration: name: GitHub Integration Tests From cd99a6ee24803325197037e01efbb8e83150a23f Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 27 Mar 2024 10:49:44 +0200 Subject: [PATCH 27/31] temporary print values 7 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f9fe2eb10..15e01a115 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -133,7 +133,7 @@ jobs: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} run: | echo "event name is: ${{ github.event_name }}" - echo "PLATFORM_URL value is: ${{ secrets.PLATFORM_URL }}" + echo "PLATFORM_URL value is: ::add-mask::${{ secrets.PLATFORM_URL }}" echo "DEV_MASTER_PLATFORM_URL value is: ${{ secrets.DEV_MASTER_PLATFORM_URL }}" echo "final JF_URL value is: $JF_URL" From c844de9a3c6595a3a20fa2b8ce4a29a762e7f6e6 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 27 Mar 2024 10:58:46 +0200 Subject: [PATCH 28/31] temporary print values 8 --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15e01a115..898023cea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -133,9 +133,10 @@ jobs: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} run: | echo "event name is: ${{ github.event_name }}" - echo "PLATFORM_URL value is: ::add-mask::${{ secrets.PLATFORM_URL }}" + echo "PLATFORM_URL value is: ${{ secrets.PLATFORM_URL }}" echo "DEV_MASTER_PLATFORM_URL value is: ${{ secrets.DEV_MASTER_PLATFORM_URL }}" - echo "final JF_URL value is: $JF_URL" + echo "EXPOSED_URL=$JF_URL" >> $GITHUB_ENV + echo "final JF_URL value is: $EXPOSED_URL" github-integration: name: GitHub Integration Tests From c2382d2aaa9e0b3a6d4ca08c3afd6cf2980f3f28 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 27 Mar 2024 11:25:33 +0200 Subject: [PATCH 29/31] temporary print values 9 --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 898023cea..cd77a5111 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -135,8 +135,9 @@ jobs: echo "event name is: ${{ github.event_name }}" echo "PLATFORM_URL value is: ${{ secrets.PLATFORM_URL }}" echo "DEV_MASTER_PLATFORM_URL value is: ${{ secrets.DEV_MASTER_PLATFORM_URL }}" - echo "EXPOSED_URL=$JF_URL" >> $GITHUB_ENV + echo "EXPOSED_URL=$(echo ${{ secrets.DEV_MASTER_PLATFORM_URL }})" # Access secret directly echo "final JF_URL value is: $EXPOSED_URL" + echo "::set-output name=jf_url::$EXPOSED_URL" github-integration: name: GitHub Integration Tests From c3f8d91bc17bdea4f22527aba880c3040508c522 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 27 Mar 2024 12:18:46 +0200 Subject: [PATCH 30/31] temporary print values 10 --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd77a5111..565bb7350 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -139,6 +139,10 @@ jobs: echo "final JF_URL value is: $EXPOSED_URL" echo "::set-output name=jf_url::$EXPOSED_URL" + - name: Print Output Context (Optional) + run: | + echo "Output JF_URL value: ${{ steps.print-secret.outputs.jf_url }}" # Access output from previous step + github-integration: name: GitHub Integration Tests needs: Pretest From b39f9cdce35f840633028eb281d3eba7f7d0d7b7 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 27 Mar 2024 12:30:30 +0200 Subject: [PATCH 31/31] temporary print values 11 --- .github/workflows/test.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 565bb7350..bfb321035 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -128,21 +128,6 @@ jobs: JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} JF_ACCESS_TOKEN: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_ADMIN_TOKEN || secrets.PLATFORM_ADMIN_TOKEN }} - - name: Print ENV - env: - JF_URL: ${{ github.event_name == 'workflow_dispatch' && secrets.DEV_MASTER_PLATFORM_URL || secrets.PLATFORM_URL }} - run: | - echo "event name is: ${{ github.event_name }}" - echo "PLATFORM_URL value is: ${{ secrets.PLATFORM_URL }}" - echo "DEV_MASTER_PLATFORM_URL value is: ${{ secrets.DEV_MASTER_PLATFORM_URL }}" - echo "EXPOSED_URL=$(echo ${{ secrets.DEV_MASTER_PLATFORM_URL }})" # Access secret directly - echo "final JF_URL value is: $EXPOSED_URL" - echo "::set-output name=jf_url::$EXPOSED_URL" - - - name: Print Output Context (Optional) - run: | - echo "Output JF_URL value: ${{ steps.print-secret.outputs.jf_url }}" # Access output from previous step - github-integration: name: GitHub Integration Tests needs: Pretest