|
| 1 | +name: 📞 OnHost Fleet Control E2E Tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + fleet_id: |
| 7 | + description: "Fleet ID to use for Fleet Control tests" |
| 8 | + required: false |
| 9 | + type: string |
| 10 | + default: "MTIyMTA0NzV8TkdFUHxGTEVFVHwwMTlkOGNkOC0xNTc1LTdjZjAtYjBlNi02ZThlYzM2YjAyODU" |
| 11 | + push: |
| 12 | + branches: [ci/fc-tests-with-running-ac] |
| 13 | + schedule: |
| 14 | + # Scheduled to run at 4 a.m on every day-of-week from Monday through Friday. |
| 15 | + - cron: "0 4 * * 1-5" |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +# NOTE: The below environment vars are bumped automatically by Renovate |
| 21 | +env: |
| 22 | + HOST_E2E_INFRA_AGENT_VERSION: "1.73.0" |
| 23 | + |
| 24 | +jobs: |
| 25 | + build-packages: |
| 26 | + name: Build packages |
| 27 | + uses: ./.github/workflows/component_packages.yml |
| 28 | + with: |
| 29 | + pre-release: false |
| 30 | + skip_sign: true |
| 31 | + tag_name: 0.900.${{ github.run_id }} |
| 32 | + |
| 33 | + on-host-linux-fleet-control-e2e: |
| 34 | + name: OnHost Linux Fleet Control E2E |
| 35 | + needs: [build-packages] |
| 36 | + runs-on: ubuntu-24.04 |
| 37 | + steps: |
| 38 | + - name: Record job start time |
| 39 | + run: echo "JOB_START_TIME=$(date +%s)" >> "$GITHUB_ENV" |
| 40 | + |
| 41 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 42 | + |
| 43 | + - uses: ./.github/actions/install-rust-toolchain |
| 44 | + |
| 45 | + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 |
| 46 | + with: |
| 47 | + name: built-binaries-0.900.${{ github.run_id }} |
| 48 | + path: ./ |
| 49 | + |
| 50 | + - name: Install newrelic-auth-rs |
| 51 | + run: cargo install --locked --git https://github.com/newrelic/newrelic-auth-rs.git |
| 52 | + |
| 53 | + - name: Get Fleet Control authentication token |
| 54 | + id: get-token |
| 55 | + run: | |
| 56 | + echo "${{ secrets.AC_FLEET_CONTROL_STAG_E2E_NR_SYSTEM_IDENTITY_PRIVATE_KEY }}" > /tmp/cred.pem |
| 57 | +
|
| 58 | + if ! newrelic-auth-cli authenticate \ |
| 59 | + --client-id "${{ secrets.AC_FLEET_CONTROL_STAG_E2E_NR_SYSTEM_IDENTITY_CLIENT_ID }}" \ |
| 60 | + --environment STAGING \ |
| 61 | + --private-key-path /tmp/cred.pem \ |
| 62 | + --output-token-format PLAIN \ |
| 63 | + > /tmp/agent-control-token.txt 2> /tmp/auth-error.log; then |
| 64 | + echo "::error::Authentication failed!" |
| 65 | + cat /tmp/auth-error.log |
| 66 | + exit 1 |
| 67 | + fi |
| 68 | +
|
| 69 | + TOKEN=$(cat /tmp/agent-control-token.txt) |
| 70 | + if [ -z "$TOKEN" ]; then |
| 71 | + echo "::error::Agent control token is empty!" |
| 72 | + exit 1 |
| 73 | + fi |
| 74 | + echo "::add-mask::$TOKEN" |
| 75 | + echo "token=$TOKEN" >> "$GITHUB_OUTPUT" |
| 76 | +
|
| 77 | + rm /tmp/cred.pem |
| 78 | + rm /tmp/agent-control-token.txt |
| 79 | +
|
| 80 | + - name: Build e2e-runner binary |
| 81 | + run: cargo build -p e2e-runner |
| 82 | + |
| 83 | + - name: Run Fleet Control E2E test |
| 84 | + run: | |
| 85 | + echo "${{ secrets.AC_FLEET_CONTROL_STAG_E2E_NR_SYSTEM_IDENTITY_PRIVATE_KEY }}" > /tmp/newrelic-agent-control-priv.key |
| 86 | +
|
| 87 | + # Use input fleet_id if provided, otherwise use default |
| 88 | + FLEET_ID="${{ inputs.fleet_id || 'MTIyMTA0NzV8TkdFUHxGTEVFVHwwMTlkOGNkOC0xNTc1LTdjZjAtYjBlNi02ZThlYzM2YjAyODU' }}" |
| 89 | +
|
| 90 | + sudo ${{ github.workspace }}/target/debug/e2e-runner fleet-control \ |
| 91 | + --artifacts-package-dir ./dist \ |
| 92 | + --nr-api-key "${{ secrets.AC_FLEET_CONTROL_STAG_E2E_API_KEY }}" \ |
| 93 | + --nr-license-key "${{ secrets.AC_FLEET_CONTROL_STAG_E2E_LICENSE_KEY }}" \ |
| 94 | + --nr-account-id "${{ secrets.AC_FLEET_CONTROL_STAG_E2E_ACCOUNT_ID }}" \ |
| 95 | + --nr-region "staging" \ |
| 96 | + --system-identity-client-id "${{ secrets.AC_FLEET_CONTROL_STAG_E2E_NR_SYSTEM_IDENTITY_CLIENT_ID }}" \ |
| 97 | + --agent-control-private-key "/tmp/newrelic-agent-control-priv.key" \ |
| 98 | + --agent-control-version "0.900.${{ github.run_id }}" \ |
| 99 | + --recipes-repo-branch "main" \ |
| 100 | + --infra-agent-version "${{ env.HOST_E2E_INFRA_AGENT_VERSION }}" \ |
| 101 | + --fleet-id "$FLEET_ID" \ |
| 102 | + --fleet-control-token "${{ steps.get-token.outputs.token }}" |
| 103 | +
|
| 104 | + - name: Report test result to New Relic |
| 105 | + if: always() |
| 106 | + env: |
| 107 | + NR_LICENSE_KEY: ${{ secrets.AC_FLEET_CONTROL_STAG_E2E_LICENSE_KEY }} |
| 108 | + NR_ACCOUNT_ID: ${{ secrets.AC_FLEET_CONTROL_STAG_E2E_ACCOUNT_ID }} |
| 109 | + E2E_SCENARIO: fleet-control |
| 110 | + E2E_ENVIRONMENT: linux-fleet-control |
| 111 | + E2E_STATUS: ${{ job.status }} |
| 112 | + E2E_CALLER_WORKFLOW: onhost-fleet-control-e2e |
| 113 | + run: bash .github/workflows/scripts/report_e2e_result.sh |
| 114 | + |
| 115 | + - name: Upload e2e result summary |
| 116 | + if: always() |
| 117 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 |
| 118 | + with: |
| 119 | + name: e2e-result-linux-fleet-control |
| 120 | + path: e2e-result-*-linux-fleet-control.txt |
| 121 | + if-no-files-found: warn |
| 122 | + |
| 123 | + on-host-fleet-control-tests-check: |
| 124 | + name: OnHost Fleet Control E2E Check |
| 125 | + if: always() |
| 126 | + runs-on: ubuntu-latest |
| 127 | + needs: [on-host-linux-fleet-control-e2e] |
| 128 | + steps: |
| 129 | + - name: Check if needed jobs succeeded |
| 130 | + uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe |
| 131 | + with: |
| 132 | + jobs: ${{ toJSON(needs) }} |
0 commit comments