From 72bd3e729f01eca9ffb0c5b99eeb523a6bf73974 Mon Sep 17 00:00:00 2001 From: Romain Marcadier Date: Mon, 13 Jan 2025 10:44:50 +0100 Subject: [PATCH] Check out orchestrion (go get can't necessarily resolve any SHA github may produce) --- .github/workflows/orchestrion.yml | 36 +++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/orchestrion.yml b/.github/workflows/orchestrion.yml index 84cb0b30a7..30c93ea412 100644 --- a/.github/workflows/orchestrion.yml +++ b/.github/workflows/orchestrion.yml @@ -80,6 +80,7 @@ jobs: - name: Checkout Code uses: actions/checkout@v4 with: + path: ${{ github.workspace }}/dd-trace-go repository: ${{ github.event != 'workflow_dispatch' && inputs.orchestrion-version != '' && 'DataDog/dd-trace-go' || github.repository }} # TODO: workflow_call ref should be set to `main` before merging... ref: ${{ github.event != 'workflow_dispatch' && inputs.orchestrion-version != '' && 'romain.marcadier/APPSEC-55160/orchestrion' || github.sha }} @@ -89,7 +90,7 @@ jobs: with: go-version: ${{ matrix.go-version }} cache: true - cache-dependency-path: 'internal/orchestrion/_integration/go.mod' + cache-dependency-path: '${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration/go.mod' # ddapm-test-agent is used to observe side effects from the tracer during integration tests. - name: Set up Python @@ -97,17 +98,25 @@ jobs: with: python-version: 3.x cache: pip - cache-dependency-path: 'internal/orchestrion/_integration/internal/agent/requirements-dev.txt' + cache-dependency-path: '${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration/internal/agent/requirements-dev.txt' - name: Install ddapm-test-agent - run: pip install -r internal/orchestrion/_integration/internal/agent/requirements-dev.txt + run: pip install -r ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration/internal/agent/requirements-dev.txt # If we're in workflow_dispatch/call, maybe we need to up/downgrade orchestrion + - name: Check out orchestrion + if: inputs.orchestrion-version != '' + id: checkout-orchestrion + uses: actions/checkout@v4 + with: + path: ${{ github.workspace }}/orchestrion + repository: DataDog/orchestrion + ref: ${{ inputs.orchestrion-version }} - name: Set up orchestrion if: inputs.orchestrion-version != '' run: |- - go get "github.com/DataDog/orchestrion@${VERSION}" + go mod edit -replace "github.com/DataDog/orchestrion=${{ github.workspace }}/orchestrion" go mod tidy - working-directory: internal/orchestrion/_integration + working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration env: VERSION: ${{ inputs.orchestrion-version }} # We install the binary to the GOBIN, so it's easy to use @@ -115,14 +124,19 @@ jobs: if: '!inputs.collect-coverage' run: |- go install "github.com/DataDog/orchestrion" - working-directory: internal/orchestrion/_integration + working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration - name: Build orchestrion binary if: inputs.collect-coverage shell: bash run: |- - go build -cover -covermode=atomic -coverpkg="github.com/DataDog/orchestrion/..." -o=/usr/local/bin/orchestrion "github.com/DataDog/orchestrion" + bin=$(go env GOPATH)/bin/orchestrion + if [[ '${{ matrix.runs-on }}' == 'windows' ]]; then + bin = "${bin}.exe" + fi + mkdir -p "$(dirname "${bin}")" + go build -cover -covermode=atomic -coverpkg="github.com/DataDog/orchestrion/..." "-o=${bin}" "github.com/DataDog/orchestrion" echo "GOCOVERDIR=$(mktemp -d)" >> "${GITHUB_ENV}" - working-directory: internal/orchestrion/_integration + working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration # Finally, we run the test suite! - name: Run Tests @@ -143,7 +157,7 @@ jobs: echo "Unknown mode: ${MODE}" ;; esac - working-directory: internal/orchestrion/_integration + working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration env: GOFLAGS: -tags=githubci${{ matrix.mode == 'DRIVER' && ',buildtag' || ''}} # The "buildtag" tag is used in //dd:span integration tests MODE: ${{ matrix.mode }} @@ -152,7 +166,7 @@ jobs: # If in workflow_call, we collected coverage data we need to upload - name: Consolidate coverage report if: inputs.collect-coverage - run: go tool covdata textfmt -i "${GOCOVERDIR}" -o ./coverage/integration.out + run: go tool covdata textfmt -i "${GOCOVERDIR}" -o ${{ github.workspace }}/orchestrion/coverage/integration.out - name: Determine go minor version if: inputs.collect-coverage id: go @@ -165,4 +179,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: coverage-integration+${{ matrix.mode }}+go${{ steps.go.outputs.version }}+${{ runner.os }}+${{ runner.arch }} - path: ./coverage/integration.out + path: ${{ github.workspace }}/orchestrion/coverage/integration.out