Skip to content

Commit 698bce2

Browse files
authored
Match Fleet server version with fleetctl version (#45)
* Perform Fleet server version lookup just-in-time * Add --fail flag to curl command * Conditionally install latest / specific version of fleetctl
1 parent df3827a commit 698bce2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/gitops-action/action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ runs:
1818
- name: Install fleetctl
1919
shell: bash
2020
working-directory: ${{ inputs.working-directory }}
21-
run: npm install -g fleetctl
21+
run: |
22+
FLEET_VERSION="$(curl "$FLEET_URL/api/v1/fleet/version" --header "Authorization: Bearer $FLEET_API_TOKEN" --fail --silent | jq --raw-output '.version')"
23+
24+
if [[ -n "$FLEET_VERSION" ]] ; then
25+
npm install -g "fleetctl@$FLEET_VERSION"
26+
else
27+
echo "Failed to get Fleet version from $FLEET_URL, installing latest version of fleetctl"
28+
npm install -g fleetctl
29+
fi
2230
2331
- name: Configure fleetctl
2432
shell: bash

0 commit comments

Comments
 (0)