From c0b69678a0b43c6af14c3b8ab59656d90f41b3f0 Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Tue, 12 May 2026 12:03:52 -0400 Subject: [PATCH 01/18] Start stubbing-out installation-logic ...beginning with downloading ZIPed archive-file --- flux-cli/package/win_install.sls | 15 +++++++++++++++ flux-cli/parameters/os_family/Windows.yaml | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 flux-cli/package/win_install.sls create mode 100644 flux-cli/parameters/os_family/Windows.yaml diff --git a/flux-cli/package/win_install.sls b/flux-cli/package/win_install.sls new file mode 100644 index 0000000..c93f105 --- /dev/null +++ b/flux-cli/package/win_install.sls @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %} +{%- set target_arch = flux_cli.get('arch', 'amd64') %} +{%- set flux_archive = 'C:\\Windows\\TEMP\\flux_windows_' ~ target_arch ~ '.zip' %} +{%- set install_dir = 'C:\\Program Files\\FluxCLI\\' ~ selected_edition %} + +Download flux CLI Archive-File: + file.managed: + - name: '{{ flux_archive }}' + - skip_verify: True + - source: '{{ flux_cli.pkg.download_uri }}' diff --git a/flux-cli/parameters/os_family/Windows.yaml b/flux-cli/parameters/os_family/Windows.yaml new file mode 100644 index 0000000..8e9ac65 --- /dev/null +++ b/flux-cli/parameters/os_family/Windows.yaml @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +# +# Set values specific to: +# salt['config.get']('os_family') == RedHat. +# +# You just need to add the key:values for this `os_family` that differ +# from `defaults.yaml` + `.yaml`. +# +# If you do not need to provide defaults via the `os_family` config, +# you can remove this file or provide at least an empty dict, e.g. +# values: {} +--- +values: + pkg: + name: flux-cli-windows +... From bbd8ba7ecfce1ec2f6e98977f2d12d379cf3c6ca Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Tue, 12 May 2026 13:56:02 -0400 Subject: [PATCH 02/18] Add archive-extraction and bin-install --- flux-cli/package/win_install.sls | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/flux-cli/package/win_install.sls b/flux-cli/package/win_install.sls index c93f105..7a0bfe9 100644 --- a/flux-cli/package/win_install.sls +++ b/flux-cli/package/win_install.sls @@ -6,10 +6,31 @@ {%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %} {%- set target_arch = flux_cli.get('arch', 'amd64') %} {%- set flux_archive = 'C:\\Windows\\TEMP\\flux_windows_' ~ target_arch ~ '.zip' %} -{%- set install_dir = 'C:\\Program Files\\FluxCLI\\' ~ selected_edition %} +{%- set install_dir = 'C:\\Program Files\\FluxCLI\\' %} Download flux CLI Archive-File: file.managed: - name: '{{ flux_archive }}' - skip_verify: True - source: '{{ flux_cli.pkg.download_uri }}' + +Extract Flux CLI from Archive-File: + archive.extracted: + - enforce_toplevel: False + - name: '{{ install_dir }}' + - onchanges: + - file: 'Download flux CLI Archive-File' + - overwrite: True + - source: '{{ flux_archive }}' + +Ensure Flux CLI is in PATH: + win_path.exists: + - name: '{{ install_dir }}' + - require: + - archive: 'Extract Flux CLI from Archive-File' + +Remove staged flux CLI Archive-File: + file.absent: + - name: '{{ flux_archive }}' + - require: + - archive: 'Extract Flux CLI from Archive-File' From d5f86ff11b21448a9a0e384090755e978a1a20ee Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Tue, 12 May 2026 14:28:20 -0400 Subject: [PATCH 03/18] Make it so the formula doesn't abort Creating as a touch-file so that, when saltstack chases all the state-file refs, it doesn't fail-out due to a missing file --- flux-cli/config/win_file.sls | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 flux-cli/config/win_file.sls diff --git a/flux-cli/config/win_file.sls b/flux-cli/config/win_file.sls new file mode 100644 index 0000000..e69de29 From 38ff6d72f71f94865a6fc18fb741b4f07e7fa1e8 Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Tue, 12 May 2026 14:38:55 -0400 Subject: [PATCH 04/18] Implement failback-to-GitHub logic --- flux-cli/package/win_install.sls | 51 ++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/flux-cli/package/win_install.sls b/flux-cli/package/win_install.sls index 7a0bfe9..78783d5 100644 --- a/flux-cli/package/win_install.sls +++ b/flux-cli/package/win_install.sls @@ -5,21 +5,66 @@ {%- set tplroot = tpldir.split('/')[0] %} {%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %} {%- set target_arch = flux_cli.get('arch', 'amd64') %} -{%- set flux_archive = 'C:\\Windows\\TEMP\\flux_windows_' ~ target_arch ~ '.zip' %} +{%- set flux_archive = 'C:\\Windows\\TEMP\\flux_windows_' ~ target_arch ~ + '.zip' %} {%- set install_dir = 'C:\\Program Files\\FluxCLI\\' %} +{#- Determine the download URI #} +{%- set download_uri = flux_cli.pkg.download_uri %} +{%- set api_response = {} %} + +{%- if not download_uri %} + {%- set api_url = 'https://api.github.com/repos/fluxcd/flux2/releases/latest' %} + {%- set api_response = salt['http.query'](api_url, decode=True, decode_type='json') %} + + {%- if 'dict' in api_response and 'tag_name' in api_response['dict'] %} + {%- set latest_tag = api_response['dict']['tag_name'] %} + {%- set version_num = latest_tag | replace('v', '') %} + {%- set download_uri = 'https://github.com/fluxcd/flux2/releases/download/' + ~ latest_tag ~ '/flux_' ~ version_num ~ '_windows_' ~ target_arch ~ + '.zip' %} + {%- endif %} +{%- endif %} + + +{%- if not download_uri %} +Alert-and-exit Due to Missing URL: + test.fail_without_changes: + - name: 'Failed to construct download_uri. Please provide the URL manually in Pillar.' + - failhard: True +{%- elif flux_cli.pkg.download_uri %} Download flux CLI Archive-File: file.managed: - name: '{{ flux_archive }}' + - onchanges_in: + - archive: 'Extract Flux CLI from Archive-File' - skip_verify: True - source: '{{ flux_cli.pkg.download_uri }}' +{%- else %} +Announce Fall-back: + test.show_notification: + - text: | + ------------------------------------------------------------------------ + No URL specified in Pillar. Attempting to download release-archive from: + + {{ download_uri }} + + ------------------------------------------------------------------------ + +Download flux CLI Archive-File: + cmd.run: + - name: 'curl -sSLf -o {{ flux_archive }} {{ download_uri }}' + - onchanges_in: + - archive: 'Extract Flux CLI from Archive-File' + - require: + - test: 'Announce Fall-back' + - unless: 'test -s {{ flux_archive }}' +{%- endif %} Extract Flux CLI from Archive-File: archive.extracted: - enforce_toplevel: False - name: '{{ install_dir }}' - - onchanges: - - file: 'Download flux CLI Archive-File' - overwrite: True - source: '{{ flux_archive }}' From cdf6f945daa522fc23f71b40646c4e873f2ef107 Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 07:52:52 -0400 Subject: [PATCH 05/18] Set up PS auto-completion --- flux-cli/config/win_file.sls | 69 ++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/flux-cli/config/win_file.sls b/flux-cli/config/win_file.sls index e69de29..3fd94f9 100644 --- a/flux-cli/config/win_file.sls +++ b/flux-cli/config/win_file.sls @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_package_install = tplroot ~ '.package.install' %} +{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %} +{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} +{%- set install_dir = 'C:\\Program Files\\FluxCLI\\' %} + + +include: + - {{ sls_package_install }} + +Generate Flux CLI PowerShell Autocompletion: + cmd.run: + - name: '& "{{ install_dir }}flux.exe" completion powershell | Out-File -FilePath "{{ install_dir }}flux-completion.ps1" -Encoding UTF8' + - shell: powershell + - onchanges: + # This ensures the command only runs if the archive was extracted (installed or updated) + - archive: 'Extract Flux CLI from Archive-File' + +# --- Legacy Windows PowerShell (v5.1) --- + +Ensure Global (default) Windows PowerShell Profile Exists: + file.managed: + - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' + - replace: False + +Ensure Flux CLI Autocompletion in Global (default) Windows PowerShell Profile: + file.blockreplace: + - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' + - marker_start: '# --- START FLUX CLI AUTOLOAD ---' + - marker_end: '# --- END FLUX CLI AUTOLOAD ---' + - content: | + if (Test-Path "{{ install_dir }}flux-completion.ps1") { + . "{{ install_dir }}flux-completion.ps1" + } + - append_if_not_found: True + - require: + - file: 'Ensure Global (default) Windows PowerShell Profile Exists' + - cmd: 'Generate Flux CLI PowerShell Autocompletion' + +# --- PowerShell Core (v7+) --- + +Ensure Global PowerShell 7 Profile Exists: + file.managed: + - name: 'C:\Program Files\PowerShell\7\profile.ps1' + - replace: False + - onlyif: + - cmd: 'Test-Path "C:\Program Files\PowerShell\7"' + - shell: powershell + +Ensure Flux CLI Autocompletion in Global PowerShell 7 Profile: + file.blockreplace: + - name: 'C:\Program Files\PowerShell\7\profile.ps1' + - marker_start: '# --- START FLUX CLI AUTOLOAD ---' + - marker_end: '# --- END FLUX CLI AUTOLOAD ---' + - content: | + if (Test-Path "{{ install_dir }}flux-completion.ps1") { + . "{{ install_dir }}flux-completion.ps1" + } + - append_if_not_found: True + - onlyif: + - cmd: 'Test-Path "C:\Program Files\PowerShell\7"' + - shell: powershell + - require: + - file: 'Ensure Global PowerShell 7 Profile Exists' + - cmd: 'Generate Flux CLI PowerShell Autocompletion' From 971339ae20458a2f83594902b8b014fade2581fe Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 08:30:29 -0400 Subject: [PATCH 06/18] Re-order states and fold long lines * re-ordering helps exposed missing and/or misstated dependencies * folding makes for easier editing/viewing in 80-column terminal sessions --- flux-cli/config/win_file.sls | 48 +++++++++++++++++------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/flux-cli/config/win_file.sls b/flux-cli/config/win_file.sls index 3fd94f9..b751ca5 100644 --- a/flux-cli/config/win_file.sls +++ b/flux-cli/config/win_file.sls @@ -12,21 +12,6 @@ include: - {{ sls_package_install }} -Generate Flux CLI PowerShell Autocompletion: - cmd.run: - - name: '& "{{ install_dir }}flux.exe" completion powershell | Out-File -FilePath "{{ install_dir }}flux-completion.ps1" -Encoding UTF8' - - shell: powershell - - onchanges: - # This ensures the command only runs if the archive was extracted (installed or updated) - - archive: 'Extract Flux CLI from Archive-File' - -# --- Legacy Windows PowerShell (v5.1) --- - -Ensure Global (default) Windows PowerShell Profile Exists: - file.managed: - - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' - - replace: False - Ensure Flux CLI Autocompletion in Global (default) Windows PowerShell Profile: file.blockreplace: - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' @@ -41,16 +26,6 @@ Ensure Flux CLI Autocompletion in Global (default) Windows PowerShell Profile: - file: 'Ensure Global (default) Windows PowerShell Profile Exists' - cmd: 'Generate Flux CLI PowerShell Autocompletion' -# --- PowerShell Core (v7+) --- - -Ensure Global PowerShell 7 Profile Exists: - file.managed: - - name: 'C:\Program Files\PowerShell\7\profile.ps1' - - replace: False - - onlyif: - - cmd: 'Test-Path "C:\Program Files\PowerShell\7"' - - shell: powershell - Ensure Flux CLI Autocompletion in Global PowerShell 7 Profile: file.blockreplace: - name: 'C:\Program Files\PowerShell\7\profile.ps1' @@ -67,3 +42,26 @@ Ensure Flux CLI Autocompletion in Global PowerShell 7 Profile: - require: - file: 'Ensure Global PowerShell 7 Profile Exists' - cmd: 'Generate Flux CLI PowerShell Autocompletion' + +Ensure Global (default) Windows PowerShell Profile Exists: + file.managed: + - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' + - replace: False + +Ensure Global PowerShell 7 Profile Exists: + file.managed: + - name: 'C:\Program Files\PowerShell\7\profile.ps1' + - replace: False + - onlyif: + - cmd: 'Test-Path "C:\Program Files\PowerShell\7"' + - shell: powershell + +Generate Flux CLI PowerShell Autocompletion: + cmd.run: + - name: > + & "{{ install_dir }}flux.exe" completion powershell | + Out-File -FilePath "{{ install_dir }}flux-completion.ps1" + -Encoding UTF8 + - shell: powershell + - onchanges: + - archive: 'Extract Flux CLI from Archive-File' From 510d5b1da3e46c6f0970b3b974dba6b8e0db8cfd Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 09:21:59 -0400 Subject: [PATCH 07/18] Provide guidance for usage of self-hosted or specific software versions --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b5a6a42..a5e9062 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,12 @@ A SaltStack formula designed to install and configure the [Flux](https://fluxcd. It is primarily expected that this formula will be run via [P3](https://www.plus3it.com/)'s "[watchmaker](https://watchmaker.readthedocs.io/en/stable/)" framework. -This formula is able to install the Flux CLI on both Linux[^1] and Windows Server[^2] operating environments. Intallation for internet-connected systems will come from the Flux CLI project's ["releases" page](https://github.com/fluxcd/flux2/releases). +This formula is able to install the Flux CLI on both Linux[^1] and Windows Server[^2] operating environments. Intallation for internet-connected systems may come from the Flux CLI project's ["releases" page](https://github.com/fluxcd/flux2/releases). If installing this way, the formula will install the latest-available version of the content. Alternately: + +* Sites whose installation-targets won't be able to reach the Flux CLI project's GitHub repository will need to self-host copies of the desired content. +* Sites that wish to use a specific version of the Flux CLI will need to target that content + +Targeting specific versions of the FluX CLI or local copies of the install-archives can be directed to do so by adding appropriate content to the formula's associated Pillar-data (see thish projct's [pillar.example](pillar.example) file for guidance). ## Available states From b088f6209c0dc60db5a2451a72bce391668dae95 Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 09:33:21 -0400 Subject: [PATCH 08/18] Try to suppress 'onlyif' warnings --- flux-cli/config/win_file.sls | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flux-cli/config/win_file.sls b/flux-cli/config/win_file.sls index b751ca5..8215f89 100644 --- a/flux-cli/config/win_file.sls +++ b/flux-cli/config/win_file.sls @@ -14,30 +14,30 @@ include: Ensure Flux CLI Autocompletion in Global (default) Windows PowerShell Profile: file.blockreplace: - - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' - - marker_start: '# --- START FLUX CLI AUTOLOAD ---' - - marker_end: '# --- END FLUX CLI AUTOLOAD ---' + - append_if_not_found: True - content: | if (Test-Path "{{ install_dir }}flux-completion.ps1") { . "{{ install_dir }}flux-completion.ps1" } - - append_if_not_found: True + - marker_end: '# --- END FLUX CLI AUTOLOAD ---' + - marker_start: '# --- START FLUX CLI AUTOLOAD ---' + - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' - require: - file: 'Ensure Global (default) Windows PowerShell Profile Exists' - cmd: 'Generate Flux CLI PowerShell Autocompletion' Ensure Flux CLI Autocompletion in Global PowerShell 7 Profile: file.blockreplace: - - name: 'C:\Program Files\PowerShell\7\profile.ps1' - - marker_start: '# --- START FLUX CLI AUTOLOAD ---' - - marker_end: '# --- END FLUX CLI AUTOLOAD ---' + - append_if_not_found: True - content: | if (Test-Path "{{ install_dir }}flux-completion.ps1") { . "{{ install_dir }}flux-completion.ps1" } - - append_if_not_found: True + - marker_end: '# --- END FLUX CLI AUTOLOAD ---' + - marker_start: '# --- START FLUX CLI AUTOLOAD ---' + - name: 'C:\Program Files\PowerShell\7\profile.ps1' - onlyif: - - cmd: 'Test-Path "C:\Program Files\PowerShell\7"' + - 'Test-Path "C:\Program Files\PowerShell\7"' - shell: powershell - require: - file: 'Ensure Global PowerShell 7 Profile Exists' @@ -51,10 +51,10 @@ Ensure Global (default) Windows PowerShell Profile Exists: Ensure Global PowerShell 7 Profile Exists: file.managed: - name: 'C:\Program Files\PowerShell\7\profile.ps1' - - replace: False - onlyif: - - cmd: 'Test-Path "C:\Program Files\PowerShell\7"' + - 'Test-Path "C:\Program Files\PowerShell\7"' - shell: powershell + - replace: False Generate Flux CLI PowerShell Autocompletion: cmd.run: @@ -62,6 +62,6 @@ Generate Flux CLI PowerShell Autocompletion: & "{{ install_dir }}flux.exe" completion powershell | Out-File -FilePath "{{ install_dir }}flux-completion.ps1" -Encoding UTF8 - - shell: powershell - onchanges: - archive: 'Extract Flux CLI from Archive-File' + - shell: powershell From 0b151e398571c68afbeab3233399b3faff8072c3 Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 10:03:57 -0400 Subject: [PATCH 09/18] Ensure new users get a ".kube" dir --- flux-cli/config/win_file.sls | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flux-cli/config/win_file.sls b/flux-cli/config/win_file.sls index 8215f89..88cb6b9 100644 --- a/flux-cli/config/win_file.sls +++ b/flux-cli/config/win_file.sls @@ -12,6 +12,13 @@ include: - {{ sls_package_install }} +Ensure Default User kubeconfig directory exists: + file.directory: + - makedirs: True + - name: 'C:\Users\Default\.kube' + - require: + - sls: {{ sls_package_install }} + Ensure Flux CLI Autocompletion in Global (default) Windows PowerShell Profile: file.blockreplace: - append_if_not_found: True From e80214105b4ee29008c6b801feb6b4a518a7c35f Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 10:15:22 -0400 Subject: [PATCH 10/18] Prep for Docker/Podman Creates a `flux-env.ps1` file for all new users. This runs runs a quick check every time a new PowerShell session is opened. If somone has installed Podman or Docker, it maps their respective native pipe endpoint to the `$env:DOCKER_HOST` variable in that PowerShell session. --- flux-cli/config/win_file.sls | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/flux-cli/config/win_file.sls b/flux-cli/config/win_file.sls index 88cb6b9..50dcc9c 100644 --- a/flux-cli/config/win_file.sls +++ b/flux-cli/config/win_file.sls @@ -26,12 +26,16 @@ Ensure Flux CLI Autocompletion in Global (default) Windows PowerShell Profile: if (Test-Path "{{ install_dir }}flux-completion.ps1") { . "{{ install_dir }}flux-completion.ps1" } + if (Test-Path "{{ install_dir }}flux-env.ps1") { + . "{{ install_dir }}flux-env.ps1" + } - marker_end: '# --- END FLUX CLI AUTOLOAD ---' - marker_start: '# --- START FLUX CLI AUTOLOAD ---' - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' - require: - file: 'Ensure Global (default) Windows PowerShell Profile Exists' - cmd: 'Generate Flux CLI PowerShell Autocompletion' + - file: 'Install user-env setup for Windows container runtimes' Ensure Flux CLI Autocompletion in Global PowerShell 7 Profile: file.blockreplace: @@ -40,6 +44,9 @@ Ensure Flux CLI Autocompletion in Global PowerShell 7 Profile: if (Test-Path "{{ install_dir }}flux-completion.ps1") { . "{{ install_dir }}flux-completion.ps1" } + if (Test-Path "{{ install_dir }}flux-env.ps1") { + . "{{ install_dir }}flux-env.ps1" + } - marker_end: '# --- END FLUX CLI AUTOLOAD ---' - marker_start: '# --- START FLUX CLI AUTOLOAD ---' - name: 'C:\Program Files\PowerShell\7\profile.ps1' @@ -49,6 +56,7 @@ Ensure Flux CLI Autocompletion in Global PowerShell 7 Profile: - require: - file: 'Ensure Global PowerShell 7 Profile Exists' - cmd: 'Generate Flux CLI PowerShell Autocompletion' + - file: 'Install user-env setup for Windows container runtimes' Ensure Global (default) Windows PowerShell Profile Exists: file.managed: @@ -72,3 +80,16 @@ Generate Flux CLI PowerShell Autocompletion: - onchanges: - archive: 'Extract Flux CLI from Archive-File' - shell: powershell + +Install user-env setup for Windows container runtimes: + file.managed: + - name: '{{ install_dir }}flux-env.ps1' + - contents: | + # Ensure Flux and Kind can locate the correct container socket on Windows + if (Get-Command podman -ErrorAction SilentlyContinue) { + $env:DOCKER_HOST = "npipe:////./pipe/podman-machine-default" + } elseif (Get-Command docker -ErrorAction SilentlyContinue) { + $env:DOCKER_HOST = "npipe:////./pipe/docker_engine" + } + - require: + - sls: {{ sls_package_install }} From a2420183b891a01ee4396d897d15366f01a2389f Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 11:56:55 -0400 Subject: [PATCH 11/18] Add cleanup steps for Windows targets --- flux-cli/config/win_clean.sls | 20 ++++++++++++++++++++ flux-cli/package/win_clean.sls | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 flux-cli/config/win_clean.sls create mode 100644 flux-cli/package/win_clean.sls diff --git a/flux-cli/config/win_clean.sls b/flux-cli/config/win_clean.sls new file mode 100644 index 0000000..87f55b1 --- /dev/null +++ b/flux-cli/config/win_clean.sls @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} + +Remove Flux Autoload from Global Windows PowerShell Profile: + file.replace: + - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' + # (?ms) enables multiline matching so we can grab the whole block at once + - pattern: '(?ms)^# --- START FLUX CLI AUTOLOAD ---.*?# --- END FLUX CLI AUTOLOAD ---$' + - repl: '' + - ignore_if_missing: True + +Remove Flux Autoload from Global PowerShell 7 Profile: + file.replace: + - name: 'C:\Program Files\PowerShell\7\profile.ps1' + - pattern: '(?ms)^# --- START FLUX CLI AUTOLOAD ---.*?# --- END FLUX CLI AUTOLOAD ---$' + - repl: '' + - ignore_if_missing: True diff --git a/flux-cli/package/win_clean.sls b/flux-cli/package/win_clean.sls new file mode 100644 index 0000000..902ad79 --- /dev/null +++ b/flux-cli/package/win_clean.sls @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_config_clean = tplroot ~ '.config.clean' %} +{%- set install_dir = 'C:\\Program Files\\FluxCLI\\' %} + +include: + - {{ sls_config_clean }} + +Ensure Flux CLI is removed from PATH: + win_path.absent: + - name: '{{ install_dir }}' + +Remove Flux CLI installation directory: + file.absent: + - name: '{{ install_dir }}' + - require: + - win_path: 'Ensure Flux CLI is removed from PATH' From 3199d8d3f7463c6146a919609b4612eceb0f36b7 Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 11:57:11 -0400 Subject: [PATCH 12/18] Align Linux clean to Windows clean ...Don't want to nuke the .../.kube setup in case other applications (that aren't removed) still need that content present --- flux-cli/config/lin_clean.sls | 4 ---- 1 file changed, 4 deletions(-) diff --git a/flux-cli/config/lin_clean.sls b/flux-cli/config/lin_clean.sls index 05c8d4c..bd9a0ec 100644 --- a/flux-cli/config/lin_clean.sls +++ b/flux-cli/config/lin_clean.sls @@ -12,10 +12,6 @@ Remove bash-completion file for Flux: file.absent: - name: '/etc/bash_completion.d/flux' -Remove kubeconfig directory for all users: - file.absent: - - name: '/etc/skel/.kube' - Remove shell-ENVs for Flux: file.absent: - name: '/etc/profile.d/flux_env.sh' From abb397dbd621a0448fcf5fce2e2a11f58c029ae2 Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 12:27:00 -0400 Subject: [PATCH 13/18] Prune the cruft Nuke out the stuff that came from the template that aren't germane to this project's actual structure --- flux-cli/config/clean.sls | 1 - flux-cli/files/default/example.tmpl.jinja | 11 -------- flux-cli/service/clean.sls | 11 -------- flux-cli/service/init.sls | 5 ---- flux-cli/service/running.sls | 17 ------------ flux-cli/subcomponent/clean.sls | 5 ---- flux-cli/subcomponent/config/clean.sls | 16 ----------- flux-cli/subcomponent/config/file.sls | 27 ------------------- .../files/default/subcomponent-example.tmpl | 6 ----- .../default/subcomponent-example.tmpl.jinja | 6 ----- flux-cli/subcomponent/config/init.sls | 5 ---- flux-cli/subcomponent/init.sls | 5 ---- 12 files changed, 115 deletions(-) delete mode 100644 flux-cli/files/default/example.tmpl.jinja delete mode 100644 flux-cli/service/clean.sls delete mode 100644 flux-cli/service/init.sls delete mode 100644 flux-cli/service/running.sls delete mode 100644 flux-cli/subcomponent/clean.sls delete mode 100644 flux-cli/subcomponent/config/clean.sls delete mode 100644 flux-cli/subcomponent/config/file.sls delete mode 100644 flux-cli/subcomponent/config/files/default/subcomponent-example.tmpl delete mode 100644 flux-cli/subcomponent/config/files/default/subcomponent-example.tmpl.jinja delete mode 100644 flux-cli/subcomponent/config/init.sls delete mode 100644 flux-cli/subcomponent/init.sls diff --git a/flux-cli/config/clean.sls b/flux-cli/config/clean.sls index c06a14d..ba2af45 100644 --- a/flux-cli/config/clean.sls +++ b/flux-cli/config/clean.sls @@ -3,7 +3,6 @@ {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} -{%- set sls_service_clean = tplroot ~ '.service.clean' %} {%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %} include: diff --git a/flux-cli/files/default/example.tmpl.jinja b/flux-cli/files/default/example.tmpl.jinja deleted file mode 100644 index a181024..0000000 --- a/flux-cli/files/default/example.tmpl.jinja +++ /dev/null @@ -1,11 +0,0 @@ -######################################################################## -# File managed by Salt at <{{ source }}>. -# Your changes will be overwritten. -######################################################################## - -This is another example file from SaltStack template-formula. - -# This is here for testing purposes -{{ flux__cd | json }} - -winner of the merge: {{ flux__cd['winner'] }} diff --git a/flux-cli/service/clean.sls b/flux-cli/service/clean.sls deleted file mode 100644 index aa120b5..0000000 --- a/flux-cli/service/clean.sls +++ /dev/null @@ -1,11 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{#- Get the `tplroot` from `tpldir` #} -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %} - -flux-cli-service-clean-service-dead: - service.dead: - - name: {{ flux_cli.service.name }} - - enable: False diff --git a/flux-cli/service/init.sls b/flux-cli/service/init.sls deleted file mode 100644 index 6fe4d1a..0000000 --- a/flux-cli/service/init.sls +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -include: - - .running diff --git a/flux-cli/service/running.sls b/flux-cli/service/running.sls deleted file mode 100644 index e8882ce..0000000 --- a/flux-cli/service/running.sls +++ /dev/null @@ -1,17 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{#- Get the `tplroot` from `tpldir` #} -{%- set tplroot = tpldir.split('/')[0] %} -{%- set sls_config_file = tplroot ~ '.config.file' %} -{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %} - -include: - - {{ sls_config_file }} - -flux-cli-service-running-service-running: - service.running: - - name: {{ flux_cli.service.name }} - - enable: True - - watch: - - sls: {{ sls_config_file }} diff --git a/flux-cli/subcomponent/clean.sls b/flux-cli/subcomponent/clean.sls deleted file mode 100644 index 564769d..0000000 --- a/flux-cli/subcomponent/clean.sls +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -include: - - .config.clean diff --git a/flux-cli/subcomponent/config/clean.sls b/flux-cli/subcomponent/config/clean.sls deleted file mode 100644 index 5b820dc..0000000 --- a/flux-cli/subcomponent/config/clean.sls +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{#- Get the `tplroot` from `tpldir` #} -{%- set tplroot = tpldir.split('/')[0] %} -{%- set sls_service_clean = tplroot ~ '.service.clean' %} -{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %} - -include: - - {{ sls_service_clean }} - -flux-cli-subcomponent-config-clean-file-absent: - file.absent: - - name: {{ flux_cli.subcomponent.config }} - - watch_in: - - sls: {{ sls_service_clean }} diff --git a/flux-cli/subcomponent/config/file.sls b/flux-cli/subcomponent/config/file.sls deleted file mode 100644 index 2dc3a9e..0000000 --- a/flux-cli/subcomponent/config/file.sls +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{#- Get the `tplroot` from `tpldir` #} -{%- set tplroot = tpldir.split('/')[0] %} -{%- set sls_config_file = tplroot ~ '.config.file' %} -{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %} -{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} - -include: - - {{ sls_config_file }} - -flux-cli-subcomponent-config-file-file-managed: - file.managed: - - name: {{ flux_cli.subcomponent.config }} - - source: {{ files_switch(['subcomponent-example.tmpl'], - lookup='flux-cli-subcomponent-config-file-file-managed', - use_subpath=True - ) - }} - - mode: 644 - - user: root - - group: {{ flux_cli.rootgroup }} - - makedirs: True - - template: jinja - - require_in: - - sls: {{ sls_config_file }} diff --git a/flux-cli/subcomponent/config/files/default/subcomponent-example.tmpl b/flux-cli/subcomponent/config/files/default/subcomponent-example.tmpl deleted file mode 100644 index 522de00..0000000 --- a/flux-cli/subcomponent/config/files/default/subcomponent-example.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -######################################################################## -# File managed by Salt at <{{ source }}>. -# Your changes will be overwritten. -######################################################################## - -This is a subcomponent example file from SaltStack template-formula. diff --git a/flux-cli/subcomponent/config/files/default/subcomponent-example.tmpl.jinja b/flux-cli/subcomponent/config/files/default/subcomponent-example.tmpl.jinja deleted file mode 100644 index cbfd51d..0000000 --- a/flux-cli/subcomponent/config/files/default/subcomponent-example.tmpl.jinja +++ /dev/null @@ -1,6 +0,0 @@ -######################################################################## -# File managed by Salt at <{{ source }}>. -# Your changes will be overwritten. -######################################################################## - -This is another subcomponent example file from SaltStack template-formula. diff --git a/flux-cli/subcomponent/config/init.sls b/flux-cli/subcomponent/config/init.sls deleted file mode 100644 index 465ddfe..0000000 --- a/flux-cli/subcomponent/config/init.sls +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -include: - - .file diff --git a/flux-cli/subcomponent/init.sls b/flux-cli/subcomponent/init.sls deleted file mode 100644 index 6003be1..0000000 --- a/flux-cli/subcomponent/init.sls +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -include: - - .config From 16de5965b8f9530155aaa71720f9569674adba63 Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 12:32:39 -0400 Subject: [PATCH 14/18] Add CIs for windows platforms Now that the Windows installation/configuration content is ready to PR, want to ensure that CI content is ready for doing so --- .github/workflows/test.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a071a98..903f5fd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,3 +25,20 @@ jobs: salt-os-version: ${{ matrix.os_version }} salt-state: ${{ matrix.salt_state }} salt-pillar-root: ${{ matrix.salt_pillar_root }} + + windows: + uses: plus3it/actions-workflows/.github/workflows/test-salt-windows.yml@ddd67e99878a285f728de398c1116151c2d7791a + strategy: + matrix: + os_version: + - windows-2019 + - windows-2022 + - windows-2025 + salt_state: + - flux-cli + salt_pillar_root: + - ./tests/pillar/test-flux-cli + with: + salt-os-version: ${{ matrix.os_version }} + salt-state: ${{ matrix.salt_state }} + salt-pillar-root: ${{ matrix.salt_pillar_root }} From 07c272c53e91f2739907c2a905153818760e92db Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 12:53:29 -0400 Subject: [PATCH 15/18] Align "archive.extracted" states IDs This should fix the: [...ELIDED...] ---------- ID: Install user-env setup for Windows container runtimes Function: file.managed Name: C:\Program Files\FluxCLI\flux-env.ps1 Result: False Comment: The following requisites were not found: require: sls: flux-cli.package.install Started: 16:36:37.916372 Duration: 0.0 ms Changes: ---------- [...ELIDED...] Witnessed during CI runs --- flux-cli/config/win_file.sls | 2 +- flux-cli/package/win_install.sls | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flux-cli/config/win_file.sls b/flux-cli/config/win_file.sls index 50dcc9c..5f3a703 100644 --- a/flux-cli/config/win_file.sls +++ b/flux-cli/config/win_file.sls @@ -78,7 +78,7 @@ Generate Flux CLI PowerShell Autocompletion: Out-File -FilePath "{{ install_dir }}flux-completion.ps1" -Encoding UTF8 - onchanges: - - archive: 'Extract Flux CLI from Archive-File' + - archive: 'Extract flux CLI Archive' - shell: powershell Install user-env setup for Windows container runtimes: diff --git a/flux-cli/package/win_install.sls b/flux-cli/package/win_install.sls index 78783d5..41a356c 100644 --- a/flux-cli/package/win_install.sls +++ b/flux-cli/package/win_install.sls @@ -37,7 +37,7 @@ Download flux CLI Archive-File: file.managed: - name: '{{ flux_archive }}' - onchanges_in: - - archive: 'Extract Flux CLI from Archive-File' + - archive: 'Extract flux CLI Archive' - skip_verify: True - source: '{{ flux_cli.pkg.download_uri }}' {%- else %} @@ -55,13 +55,13 @@ Download flux CLI Archive-File: cmd.run: - name: 'curl -sSLf -o {{ flux_archive }} {{ download_uri }}' - onchanges_in: - - archive: 'Extract Flux CLI from Archive-File' + - archive: 'Extract flux CLI Archive' - require: - test: 'Announce Fall-back' - unless: 'test -s {{ flux_archive }}' {%- endif %} -Extract Flux CLI from Archive-File: +Extract flux CLI Archive: archive.extracted: - enforce_toplevel: False - name: '{{ install_dir }}' @@ -72,10 +72,10 @@ Ensure Flux CLI is in PATH: win_path.exists: - name: '{{ install_dir }}' - require: - - archive: 'Extract Flux CLI from Archive-File' + - archive: 'Extract flux CLI Archive' Remove staged flux CLI Archive-File: file.absent: - name: '{{ flux_archive }}' - require: - - archive: 'Extract Flux CLI from Archive-File' + - archive: 'Extract flux CLI Archive' From 40f3d374b8f6269c9c620a598bde325783f60b3e Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 13:18:21 -0400 Subject: [PATCH 16/18] Change requisite-chasing method --- flux-cli/config/lin_file.sls | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flux-cli/config/lin_file.sls b/flux-cli/config/lin_file.sls index dc64a50..b9b4ad6 100644 --- a/flux-cli/config/lin_file.sls +++ b/flux-cli/config/lin_file.sls @@ -27,7 +27,7 @@ Ensure Docker Service for Flux/Kind: - name: 'docker' - enable: True - require: - - file: 'Enforce flux permissions and SELinux' + - sls: {{ sls_package_install }} - require_in: - file: 'Install user-env setup for Podman socket' {%- endif %} @@ -39,7 +39,7 @@ Ensure Podman Socket for Kind: - enable: True - comment: "Podman detected; enabling socket for Flux/Kind compatibility." - require: - - file: 'Enforce flux permissions and SELinux' + - sls: {{ sls_package_install }} - require_in: - file: 'Install user-env setup for Podman socket' {%- endif %} @@ -48,7 +48,7 @@ Ensure bash-completion package is present: pkg.installed: - name: bash-completion - require: - - file: 'Enforce flux permissions and SELinux' + - sls: {{ sls_package_install }} Ensure kubeconfig directory for all users: file.directory: From b839fa49a79b087deb974de1235b5f0a4e323a93 Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 13:36:21 -0400 Subject: [PATCH 17/18] Move away from being a null-router Ensure that the "install" (etc.) state-file(s) doesn't evaluate to empty: this should prevent previously-witnessed CI errors without resorting to a bunch of other ugly and/or brittle kludgery --- flux-cli/config/clean.sls | 2 ++ flux-cli/config/file.sls | 3 ++- flux-cli/package/clean.sls | 2 ++ flux-cli/package/install.sls | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/flux-cli/config/clean.sls b/flux-cli/config/clean.sls index ba2af45..55bc866 100644 --- a/flux-cli/config/clean.sls +++ b/flux-cli/config/clean.sls @@ -12,3 +12,5 @@ include: - flux-cli.config.win_clean {%- endif %} +Avoid being a null-router (config/clean): + test.nop: [] diff --git a/flux-cli/config/file.sls b/flux-cli/config/file.sls index ad68683..caeae91 100644 --- a/flux-cli/config/file.sls +++ b/flux-cli/config/file.sls @@ -15,4 +15,5 @@ include: - flux-cli.config.win_file {%- endif %} - +Avoid being a null-router (config/file): + test.nop: [] diff --git a/flux-cli/package/clean.sls b/flux-cli/package/clean.sls index 46d02cb..3216007 100644 --- a/flux-cli/package/clean.sls +++ b/flux-cli/package/clean.sls @@ -14,3 +14,5 @@ include: - flux-cli.package.win_clean {%- endif %} +Avoid being a null-router (package/clean): + test.nop: [] diff --git a/flux-cli/package/install.sls b/flux-cli/package/install.sls index 6324664..fb87cf0 100644 --- a/flux-cli/package/install.sls +++ b/flux-cli/package/install.sls @@ -12,3 +12,5 @@ include: - flux-cli.package.win_install {%- endif %} +Avoid being a null-router (package/install): + test.nop: [] From bc4edaabe473e50fbb36be156e732de5dd25e950 Mon Sep 17 00:00:00 2001 From: Thomas H Jones II Date: Wed, 13 May 2026 14:14:22 -0400 Subject: [PATCH 18/18] Update project-version --- .bumpversion.cfg | 2 +- CHANGELOG.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 871c1b1..9452bf3 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.0 +current_version = 0.1.1 commit = True message = Bumps version to {new_version} tag = False diff --git a/CHANGELOG.md b/CHANGELOG.md index d5d22bc..6d28227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +### 0.1.1 + +**Released**: 2026.05.13 + +**Summary**: + +* Adds setup-capability for Windows-based onfiguration-targets (tested with Windows Server 2022) +* Adds Windows-related CI features to project +* Add conditional, VERY basic integration-steps for Podman and Docker + ### 0.1.0 **Released**: 2026.05.12