From c07fe54eb39ca2e00f46e33ee2bb87733a48ac14 Mon Sep 17 00:00:00 2001 From: Victor Lyuboslavsky Date: Mon, 21 Oct 2024 10:50:32 -0500 Subject: [PATCH] Fixed run issue with empty/missing teams folder. (#55) Also added documentation for setting `--delete-other-teams` to false until this is fixed in fleetctl. --- .github/workflows/workflow.yml | 1 + README.md | 4 ++++ gitops.sh | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 2dffdd7..053602c 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -32,6 +32,7 @@ jobs: with: # Run GitOps in dry-run mode for pull requests. dry-run-only: ${{ github.event_name == 'pull_request' && 'true' || 'false' }} + # delete-other-teams: false # Add FLEET_URL and FLEET_API_TOKEN to the repository secrets. # In addition, specify or add secrets for all the environment variables that are mentioned in the global/team YAML files. env: diff --git a/README.md b/README.md index b3b9ab2..d02db00 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ Rather than relying on multiple teams for tools like Intune or Jamf, build a uni 3. Add `FLEET_GLOBAL_ENROLL_SECRET` secret to your new repository's secrets. The enroll secret must be an alphanumeric string of at least 32 and at most 255 characters. - If you have a Premium Fleet license, also add `FLEET_WORKSTATIONS_ENROLL_SECRET` and `FLEET_WORKSTATIONS_CANARY_ENROLL_SECRET`. + - If you do not have a Premium Fleet license, uncomment the following line in `.github/workflows/workflow.yml`: +```yaml + # delete-other-teams: false +``` 4. Delete `.gitlab-ci.yml`, which is for GitLab CI/CD. diff --git a/gitops.sh b/gitops.sh index da13393..10f759d 100755 --- a/gitops.sh +++ b/gitops.sh @@ -23,7 +23,9 @@ fi args=(-f "$FLEET_GLOBAL_FILE") for team_file in "$FLEET_GITOPS_DIR"/teams/*.yml; do - args+=(-f "$team_file") + if [ -f "$team_file" ]; then + args+=(-f "$team_file") + fi done if [ "$FLEET_DELETE_OTHER_TEAMS" = true ]; then args+=(--delete-other-teams)