mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.1.3 to 4.0.1. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/setup-go/releases">actions/setup-go's releases</a>.</em></p> <blockquote> <h2>v4.0.1</h2> <h2>What's Changed</h2> <ul> <li>Update documentation for <code>v4</code> by <a href="https://github.com/dsame"><code>@dsame</code></a> in <a href="https://redirect.github.com/actions/setup-go/pull/354">actions/setup-go#354</a></li> <li>Fix glob bug in the package.json scripts section by <a href="https://github.com/IvanZosimov"><code>@IvanZosimov</code></a> in <a href="https://redirect.github.com/actions/setup-go/pull/359">actions/setup-go#359</a></li> <li>Bump <code>xml2js</code> dependency by <a href="https://github.com/dmitry-shibanov"><code>@dmitry-shibanov</code></a> in <a href="https://redirect.github.com/actions/setup-go/pull/370">actions/setup-go#370</a></li> <li>Bump <code>@actions/cache</code> dependency to v3.2.1 by <a href="https://github.com/nikolai-laevskii"><code>@nikolai-laevskii</code></a> in <a href="https://redirect.github.com/actions/setup-go/pull/374">actions/setup-go#374</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/nikolai-laevskii"><code>@nikolai-laevskii</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-go/pull/374">actions/setup-go#374</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/setup-go/compare/v4...v4.0.1">https://github.com/actions/setup-go/compare/v4...v4.0.1</a></p> <h2>v4.0.0</h2> <p>In scope of release we enable cache by default. The action won’t throw an error if the cache can’t be restored or saved. The action will throw a warning message but it won’t stop a build process. The cache can be disabled by specifying <code>cache: false</code>.</p> <pre lang="yaml"><code>steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: go-version: ‘1.19’ - run: go run hello.go </code></pre> <p>Besides, we introduce such changes as</p> <ul> <li><a href="https://redirect.github.com/actions/setup-go/pull/305">Allow to use only GOCACHE for cache</a></li> <li><a href="https://redirect.github.com/actions/setup-go/pull/315">Bump json5 from 2.2.1 to 2.2.3</a></li> <li><a href="https://redirect.github.com/actions/setup-go/pull/323">Use proper version for primary key in cache</a></li> <li><a href="https://redirect.github.com/actions/setup-go/pull/351">Always add Go bin to the PATH</a></li> <li><a href="https://redirect.github.com/actions/setup-go/pull/350">Add step warning if go-version input is empty</a></li> </ul> <h2>Add support for stable and oldstable aliases</h2> <p>In scope of this release we introduce aliases for the <code>go-version</code> input. The <code>stable</code> alias instals the latest stable version of Go. The <code>oldstable</code> alias installs previous latest minor release (the stable is 1.19.x -> the oldstable is 1.18.x).</p> <h3>Stable</h3> <pre lang="yaml"><code>steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: go-version: 'stable' - run: go run hello.go </code></pre> <h3>OldStable</h3> <pre lang="yaml"><code>steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 </tr></table> </code></pre> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="fac708d667"><code>fac708d</code></a> Bump <code>@actions/cache</code> dependency to v3.2.1 (<a href="https://redirect.github.com/actions/setup-go/issues/374">#374</a>)</li> <li><a href="dd84a9531a"><code>dd84a95</code></a> Update xml2js (<a href="https://redirect.github.com/actions/setup-go/issues/370">#370</a>)</li> <li><a href="41c2024c46"><code>41c2024</code></a> Fix glob bug in package.json scripts section (<a href="https://redirect.github.com/actions/setup-go/issues/359">#359</a>)</li> <li><a href="8dbf352f06"><code>8dbf352</code></a> update README fo v4 (<a href="https://redirect.github.com/actions/setup-go/issues/354">#354</a>)</li> <li><a href="4d34df0c23"><code>4d34df0</code></a> Update configuration files (<a href="https://redirect.github.com/actions/setup-go/issues/348">#348</a>)</li> <li><a href="fdc0d672a1"><code>fdc0d67</code></a> Add Go bin if go-version input is empty (<a href="https://redirect.github.com/actions/setup-go/issues/351">#351</a>)</li> <li><a href="ebfdf6ac95"><code>ebfdf6a</code></a> add warning if go-version is empty (<a href="https://redirect.github.com/actions/setup-go/issues/350">#350</a>)</li> <li><a href="b27d76912e"><code>b27d769</code></a> fix lockfileVersion (<a href="https://redirect.github.com/actions/setup-go/issues/349">#349</a>)</li> <li><a href="c51a720768"><code>c51a720</code></a> Enable caching by default with default input (<a href="https://redirect.github.com/actions/setup-go/issues/332">#332</a>)</li> <li><a href="6b848af622"><code>6b848af</code></a> Merge pull request <a href="https://redirect.github.com/actions/setup-go/issues/343">#343</a> from akv-platform/reusable-workflow</li> <li>Additional commits viewable in <a href="https://github.com/actions/setup-go/compare/v2.1.3...v4.0.1">compare view</a></li> </ul> </details> <br /> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
326 lines
12 KiB
YAML
326 lines
12 KiB
YAML
# This workflow tests enrolling of agents on the supported platforms,
|
|
# using the latest version of fleet, fleetctl and orbit.
|
|
#
|
|
# It starts the latest release of fleet with the "fleetctl preview" command.
|
|
# It generates the installers for the latest version of Orbit with the
|
|
# "fleetctl package" command.
|
|
name: Test Fleetctl, Orbit & Preview
|
|
|
|
on:
|
|
workflow_dispatch: # Manual
|
|
schedule:
|
|
- cron: '0 2 * * *' # Nightly 2AM UTC
|
|
|
|
# This allows a subsequently queued workflow run to interrupt previous runs
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id}}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
# fail-fast using bash -eo pipefail. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
|
|
shell: bash
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
gen:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
subdomain: ${{ steps.gen.outputs.subdomain }}
|
|
address: ${{ steps.gen.outputs.address }}
|
|
steps:
|
|
- id: gen
|
|
run: |
|
|
UUID=$(uuidgen)
|
|
echo "subdomain=fleet-test-$UUID" >> $GITHUB_OUTPUT
|
|
echo "address=https://fleet-test-$UUID.fleetuem.com" >> $GITHUB_OUTPUT
|
|
|
|
run-server:
|
|
runs-on: ubuntu-latest
|
|
needs: gen
|
|
steps:
|
|
- name: Start tunnel
|
|
env:
|
|
CERT_PEM: ${{ secrets.CLOUDFLARE_TUNNEL_FLEETUEM_CERT_B64 }}
|
|
run: |
|
|
# Install cloudflared
|
|
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
|
|
sudo dpkg -i cloudflared-linux-amd64.deb
|
|
# Add secret
|
|
echo "$CERT_PEM" | base64 -d > cert.pem
|
|
# Start tunnel
|
|
cloudflared tunnel --origincert cert.pem --hostname ${{ needs.gen.outputs.subdomain }} --url http://localhost:1337 --name ${{ needs.gen.outputs.subdomain }} &
|
|
until [[ $(cloudflared tunnel --origincert cert.pem info -o json ${{ needs.gen.outputs.subdomain }} | jq '.conns[0].conns[0].is_pending_reconnect') = false ]]; do
|
|
echo "Awaiting tunnel ready..."
|
|
sleep 5
|
|
done
|
|
|
|
# Download fleet and fleetctl binaries from last successful build on main
|
|
- name: Download binaries
|
|
uses: dawidd6/action-download-artifact@5e780fc7bbd0cac69fc73271ed86edf5dcb72d67
|
|
with:
|
|
workflow: build-binaries.yaml
|
|
branch: main
|
|
name: build
|
|
path: build
|
|
check_artifacts: true
|
|
|
|
- name: Run Fleet server
|
|
timeout-minutes: 15
|
|
env:
|
|
# Use instance identifier to allow for duplicate UUIDs
|
|
FLEET_OSQUERY_HOST_IDENTIFIER: instance
|
|
run: |
|
|
chmod +x ./build/fleetctl
|
|
./build/fleetctl preview --no-hosts
|
|
./build/fleetctl config set --address ${{ needs.gen.outputs.address }}
|
|
./build/fleetctl get enroll-secret
|
|
docker compose -f ~/.fleet/preview/docker-compose.yml logs --follow fleet01 fleet02 &
|
|
# Wait for all of the hosts to be enrolled
|
|
EXPECTED=12
|
|
until [ $(./build/fleetctl get hosts --json | wc -l | tee hostcount) -ge $EXPECTED ]; do
|
|
echo -n "Waiting for hosts to enroll: "
|
|
cat hostcount | xargs echo -n
|
|
echo " / $EXPECTED"
|
|
sleep 10
|
|
done
|
|
./build/fleetctl get hosts
|
|
echo "Success! $EXPECTED hosts enrolled."
|
|
|
|
- name: Slack Notification
|
|
if: failure()
|
|
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
|
|
with:
|
|
payload: |
|
|
{
|
|
"text": "${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}",
|
|
"blocks": [
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "Integration test result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_G_HELP_ENGINEERING_WEBHOOK_URL }}
|
|
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
|
|
|
|
- name: Cleanup tunnel
|
|
if: always()
|
|
run: cloudflared tunnel --origincert cert.pem delete --force ${{ needs.gen.outputs.subdomain }}
|
|
|
|
login:
|
|
runs-on: ubuntu-latest
|
|
needs: gen
|
|
outputs:
|
|
token: ${{ steps.login.outputs.token }}
|
|
steps:
|
|
# Download fleet and fleetctl binaries from last successful build on main
|
|
- name: Download binaries
|
|
uses: dawidd6/action-download-artifact@5e780fc7bbd0cac69fc73271ed86edf5dcb72d67
|
|
with:
|
|
workflow: build-binaries.yaml
|
|
branch: main
|
|
name: build
|
|
path: build
|
|
check_artifacts: true
|
|
|
|
# Login only here and share the token because otherwise we could hit rate limits.
|
|
- id: login
|
|
name: Attempt login
|
|
timeout-minutes: 5
|
|
run: |
|
|
chmod +x ./build/fleetctl
|
|
./build/fleetctl config set --address ${{ needs.gen.outputs.address }}
|
|
until ./build/fleetctl login --email admin@example.com --password preview1337#
|
|
do
|
|
echo "Retrying in 5s..."
|
|
sleep 5
|
|
done
|
|
TOKEN=$(cat ~/.fleet/config| grep token | awk '{ print $2 }')
|
|
echo "token=$TOKEN" >> $GITHUB_OUTPUT
|
|
|
|
orbit-macos:
|
|
timeout-minutes: 15
|
|
strategy:
|
|
matrix:
|
|
orbit-channel: [ 'stable', 'edge' ]
|
|
osqueryd-channel: ['stable', 'edge' ]
|
|
runs-on: macos-latest
|
|
needs: [gen, login]
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
npm install -g fleetctl
|
|
fleetctl config set --address ${{ needs.gen.outputs.address }} --token ${{ needs.login.outputs.token }}
|
|
|
|
- name: Install Orbit
|
|
run: |
|
|
sudo hostname macos-orbit-${{ matrix.orbit-channel }}-osqueryd-${{ matrix.osqueryd-channel }}
|
|
SECRET_JSON=$(fleetctl get enroll_secret --json --debug)
|
|
echo $SECRET_JSON
|
|
SECRET=$(echo $SECRET_JSON | jq -r '.spec.secrets[0].secret')
|
|
echo "Secret: $SECRET"
|
|
echo "Hostname: $(hostname -s)"
|
|
fleetctl package --type pkg --fleet-url=${{ needs.gen.outputs.address }} --enroll-secret=$SECRET --orbit-channel=${{ matrix.orbit-channel }} --osqueryd-channel=${{ matrix.osqueryd-channel }} --fleet-desktop
|
|
sudo installer -pkg fleet-osquery.pkg -target /
|
|
until fleetctl get hosts | grep -iF $(hostname -s);
|
|
do
|
|
echo "Awaiting enrollment..."
|
|
sleep 10
|
|
done
|
|
|
|
- name: Collect orbit logs
|
|
if: always()
|
|
run: |
|
|
mkdir orbit-logs
|
|
sudo cp /var/log/orbit/* orbit-logs/
|
|
|
|
- name: Upload Orbit logs
|
|
if: always()
|
|
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v2
|
|
with:
|
|
name: orbit-macos-${{ matrix.orbit-channel }}-${{ matrix.osqueryd-channel }}-logs
|
|
path: |
|
|
orbit-logs
|
|
|
|
- name: Uninstall Orbit
|
|
run: |
|
|
./orbit/tools/cleanup/cleanup_macos.sh
|
|
|
|
orbit-ubuntu:
|
|
timeout-minutes: 15
|
|
strategy:
|
|
matrix:
|
|
orbit-channel: [ 'stable', 'edge' ]
|
|
osqueryd-channel: ['stable', 'edge' ]
|
|
runs-on: ubuntu-latest
|
|
needs: [gen, login]
|
|
steps:
|
|
- name: Install dependencies
|
|
run: |
|
|
npm install -g fleetctl
|
|
fleetctl config set --address ${{ needs.gen.outputs.address }} --token ${{ needs.login.outputs.token }}
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@v4.0.1
|
|
with:
|
|
go-version: '^1.19.10'
|
|
|
|
- name: Checkout Code
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
|
|
|
|
- name: Build Fleetctl
|
|
run: make fleetctl
|
|
|
|
- name: Install Orbit
|
|
run: |
|
|
sudo hostname ubuntu-orbit-${{ matrix.orbit-channel }}-osqueryd-${{ matrix.osqueryd-channel }}
|
|
chmod +x ./build/fleetctl
|
|
SECRET_JSON=$(fleetctl get enroll_secret --json --debug)
|
|
echo $SECRET_JSON
|
|
SECRET=$(echo $SECRET_JSON | jq -r '.spec.secrets[0].secret')
|
|
echo "Secret: $SECRET"
|
|
echo "Hostname: $(hostname -s)"
|
|
./build/fleetctl package --type deb --fleet-url=${{ needs.gen.outputs.address }} --enroll-secret=$SECRET --orbit-channel=${{ matrix.orbit-channel }} --osqueryd-channel=${{ matrix.osqueryd-channel }}
|
|
sudo dpkg -i fleet-osquery*
|
|
until fleetctl get hosts | grep -iF $(hostname -s);
|
|
do
|
|
echo "Awaiting enrollment..."
|
|
sudo systemctl status orbit.service || true
|
|
sleep 10
|
|
done
|
|
|
|
- name: Collect orbit logs
|
|
if: always()
|
|
run: |
|
|
sudo journalctl -u orbit.service > orbit-logs
|
|
|
|
- name: Upload Orbit logs
|
|
if: always()
|
|
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v2
|
|
with:
|
|
name: orbit-ubuntu-${{ matrix.orbit-channel }}-${{ matrix.osqueryd-channel }}-logs
|
|
path: |
|
|
orbit-logs
|
|
|
|
- name: Uninstall Orbit
|
|
run: |
|
|
sudo apt remove fleet-osquery -y
|
|
|
|
orbit-windows-build:
|
|
timeout-minutes: 15
|
|
strategy:
|
|
matrix:
|
|
orbit-channel: [ 'stable', 'edge' ]
|
|
osqueryd-channel: ['stable', 'edge' ]
|
|
runs-on: ubuntu-latest
|
|
needs: [gen, login]
|
|
steps:
|
|
- name: Install dependencies
|
|
run: |
|
|
docker pull fleetdm/wix:latest &
|
|
npm install -g fleetctl
|
|
fleetctl config set --address ${{ needs.gen.outputs.address }} --token ${{ needs.login.outputs.token }}
|
|
|
|
- name: Build Orbit
|
|
run: |
|
|
SECRET_JSON=$(fleetctl get enroll_secret --json --debug)
|
|
echo $SECRET_JSON
|
|
SECRET=$(echo $SECRET_JSON | jq -r '.spec.secrets[0].secret')
|
|
echo "Secret: $SECRET"
|
|
echo "Hostname: $(hostname -s)"
|
|
fleetctl package --type msi --fleet-url=${{ needs.gen.outputs.address }} --enroll-secret=$SECRET --orbit-channel=${{ matrix.orbit-channel }} --osqueryd-channel=${{ matrix.osqueryd-channel }} --fleet-desktop
|
|
mv fleet-osquery.msi orbit-${{ matrix.orbit-channel }}-osqueryd-${{ matrix.osqueryd-channel }}.msi
|
|
|
|
- name: Upload MSI
|
|
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v2
|
|
with:
|
|
name: orbit-${{ matrix.orbit-channel }}-osqueryd-${{ matrix.osqueryd-channel }}.msi
|
|
path: orbit-${{ matrix.orbit-channel }}-osqueryd-${{ matrix.osqueryd-channel }}.msi
|
|
|
|
orbit-windows:
|
|
timeout-minutes: 15
|
|
strategy:
|
|
matrix:
|
|
orbit-channel: [ 'stable', 'edge' ]
|
|
osqueryd-channel: ['stable', 'edge' ]
|
|
needs: [gen, login, orbit-windows-build]
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Install dependencies
|
|
shell: bash
|
|
run: |
|
|
npm install -g fleetctl
|
|
fleetctl config set --address ${{ needs.gen.outputs.address }} --token ${{ needs.login.outputs.token }} --tls-skip-verify
|
|
|
|
- name: Download MSI
|
|
id: download
|
|
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v2
|
|
with:
|
|
name: orbit-${{ matrix.orbit-channel }}-osqueryd-${{ matrix.osqueryd-channel }}.msi
|
|
|
|
|
|
- name: Install Orbit
|
|
run: |
|
|
msiexec /i ${{steps.download.outputs.download-path}}\orbit-${{ matrix.orbit-channel }}-osqueryd-${{ matrix.osqueryd-channel }}.msi /quiet /passive /lv log.txt
|
|
sleep 30
|
|
|
|
# We can't very accurately check the install on these Windows hosts since the hostnames tend to
|
|
# overlap and we can't control the hostnames. Instead we just return and have the run-server job
|
|
# wait until the expected number of hosts enroll.
|
|
|
|
- name: Upload Orbit logs
|
|
if: always()
|
|
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v2
|
|
with:
|
|
name: orbit-windows-${{ matrix.orbit-channel }}-${{ matrix.osqueryd-channel }}-logs
|
|
path: C:\Windows\system32\config\systemprofile\AppData\Local\FleetDM\Orbit\Logs\orbit-osquery.log
|