jenkins-infra / helpdesk

Open your Infrastructure related issues here for the Jenkins project
https://github.com/jenkins-infra/helpdesk/issues/new/choose
17 stars 10 forks source link

Packer-Images: bug within updatecli to update goss since exclusion of windows 2019 for vsstudio #4090

Closed smerle33 closed 5 months ago

smerle33 commented 6 months ago

Service(s)

Other

Summary

since jenkins-infra/packer-images@7a2b820 (#1143) that is able to exclude windows 2022 but still test windows 2019 the updatecli process fail as the yaml file is no longer a correct yaml.

Reproduction steps

No response

smerle33 commented 6 months ago

when using the scalar block:

skip: |
    {{ not (eq .Env.AGENT_OS_VERSION "2019") }}

updatecli is not complaining anymore and the yaml parsing go through HOWEVER the goss templating is falling :

 yaml: unmarshal errors:
  line 62: cannot unmarshal !!str `false
` into bool

if I put it back on one line:

skip: {{ not (eq .Env.AGENT_OS_VERSION "2019") }}

goss is working fine but then updatecli complain:

ERROR: something went wrong in target "updateJDK21VersionInGoss" : "updating yaml file: parsing yaml file: [62:12] unexpected mapping key\n      59 |     exit-status: 0\n      60 |     stdout:\n      61 |       - /16\\.\\d+\\.\\d+\\.\\d+/\n    > 62 |     skip: {{ not (eq .Env.AGENT_OS_VERSION \"2019\") }}\n                      ^\n      63 | file:\n      64 |   C:\\Program Files\\Chromium\\Application\\:\n      65 |     contains: []"

which is weird as the yaml file is seen as good with yaml online parser ... maybe this is coming from the library used by updatecli to parse yaml: https://github.com/goccy/go-yaml or a wrong behavior from goss

EDIT: setting yamlpath as the updatecli yaml engine solve the problem, but it need to be done on each file updating the goss yaml file.

I did open an issue on goss : https://github.com/goss-org/goss/issues/913

smerle33 commented 6 months ago

for now the updatecli is more important for us to keep our image uptodate so I kept the scalar block version even if it mean to skip the goss test for visualstudio

smerle33 commented 6 months ago

lock on the exec for windows not behaving correctly :

[2024-05-17T14:18:59.052Z] �[0;32m2024-05-17T14:18:58Z:     azure-arm.windows: ......FF...................�[0m
[2024-05-17T14:18:59.052Z] �[1;31m2024-05-17T14:18:58Z: ==> azure-arm.windows: 2024-05-17T14:18:57Z [DEBUG][Command][visualstudio][stderr]  'C:\Program' is not recognized as an internal or external command,�[0m
[2024-05-17T14:18:59.052Z] �[0;32m2024-05-17T14:18:58Z:     azure-arm.windows:�[0m
[2024-05-17T14:18:59.052Z] �[1;31m2024-05-17T14:18:58Z: ==> azure-arm.windows: 2024-05-17T14:18:57Z [DEBUG][Command][visualstudio][stderr]  operable program or batch file.�[0m
[2024-05-17T14:18:59.052Z] �[1;31m2024-05-17T14:18:58Z: ==> azure-arm.windows: 2024-05-17T14:18:57Z [DEBUG][Command][visualstudio][stderr]�[0m
[2024-05-17T14:18:59.052Z] �[0;32m2024-05-17T14:18:58Z:     azure-arm.windows: Failures/Skipped:�[0m
[2024-05-17T14:18:59.052Z] �[0;32m2024-05-17T14:18:58Z:     azure-arm.windows:�[0m
smerle33 commented 5 months ago

last error : The filename, directory name, or volume label syntax is incorrect

18:57:22  
2024-05-20T16:57:21Z: ==> azure-arm.windows: 2024-05-20T16:57:21Z [DEBUG][Command][visualstudio][stderr]  The filename, directory name, or volume label syntax is incorrect.

18:57:22  
2024-05-20T16:57:21Z: ==> azure-arm.windows: 2024-05-20T16:57:21Z [DEBUG][Command][visualstudio][stderr]

with :

exec: "'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe' -nologo -version"
smerle33 commented 5 months ago

working using () and " :

exec: ("C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" "/nologo" "/version")