Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zarf 0.31.1: "localOS: ..." Tag in zarf.yaml does not work anymore (on Windows and Linux) #2158

Closed
Ghost-Of-Tsushima opened this issue Nov 23, 2023 · 3 comments · Fixed by #2173

Comments

@Ghost-Of-Tsushima
Copy link

Environment

Device and OS: Linux (and Windows Server 2019)
App version: Zarf v0.31.1
Kubernetes distro being used: k3s with zarf included (running only on Linux)
Other:

Steps to reproduce

  1. Build Zarf Package with Zarf v.0.31.1 on Linux
  2. Deploy the same Zarf Package on a Linux system with atleast following zarf.yaml (should be in build too):
  - name: basic name
    only:
      localOS: windows
    actions:
      onDeploy:
        after:
          - cmd: "<Placeholder for Powershell-only Command>"
  1. Build Zarf Package with Zarf v.0.31.1 on Linux
  2. Deploy the same Zarf Package on a Windows system with atleast following zarf.yaml (should be in build too):
  - name: basic name
    only:
      localOS: linux
    actions:
      onDeploy:
        after:
          - cmd: "<Placeholder for bash/linux-only Command>"

Expected result

  • When the first yaml-block (localOS: windows) is run on a Linux System, it should not be interpreted at all by bourneshell and just skipped. When its run on a Windows System, it should be interpreted and run correctly.

  • When the seconf yaml-block (localOS: Linux) is run on a Windows System, it should not be interpreted at all by Powershell and just skipped. When its run on a Linux System, it should be interpreted and run correctly.

Actual Result

  • When zarf deploy <packagename> is executed on a linux system, there is an error: sh: 1: Syntax error: <powershell-command, that cant get interpreted by bourneshell>

  • When zarf deploy <packagename> is executed on a windows system, there is an error: Powershell error: <Bash-command that cant get interpreted by powershell>

Visual Proof (screenshots, videos, text, etc)

zarf.yaml:
errorforzarfissue
Powershell-Error:
errorpowershell
Linux-Error:
yamlerrorlinux

Severity/Priority

  • Medium, because the functionality above is not working anymore

Additional Context

I upgraded from Zarf Version v0.29.2 to v0.31.1. In Version v0.29.2 it worked perfectly fine. I didn't alter the code in any shape or form.

@Racer159
Copy link
Contributor

Racer159 commented Dec 1, 2023

@Ghost-Of-Tsushima are you seeing this on v0.31.3 as well? Testing with this simple example on v0.31.3 and v0.31.1 and I didn't see the same behavior:

kind: ZarfPackageConfig
metadata:
  name: test

components:
  - name: basic-name
    required: true
    only:
      localOS: windows
    actions:
      onDeploy:
        after:
          - cmd: echo Windows!
  - name: basic-name2
    required: true
    only:
      localOS: linux
    actions:
      onDeploy:
        after:
          - cmd: echo Linux!

image

@Racer159
Copy link
Contributor

Racer159 commented Dec 1, 2023

(also it looks like the component names are different between the zarf.yaml and the run screenshots - is there a potential you are using composable components with this and maybe the issue is there?)

@Racer159
Copy link
Contributor

Racer159 commented Dec 1, 2023

(investigated deeper in code and that is what is happening. will add checks for that)

Racer159 added a commit that referenced this issue Dec 6, 2023
## Description

This fixes an issue where compose could drop the `only.localOS` filter
through compose.

## Related Issue

Fixes #2158

## Type of change

- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [X] Test, docs, adr added or updated as needed
- [X] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed

---------

Co-authored-by: Lucas Rodriguez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants