From 6cb492cd008de95b12e3c09ea80074521c209b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20MERLE?= <95630726+smerle33@users.noreply.github.com> Date: Mon, 18 Dec 2023 16:45:36 +0100 Subject: [PATCH] chore(updatecli): add goss-windows as target (#940) * wip * chore git message --- goss/goss-windows.yaml | 42 ++------------ provisioning/windows-provision.ps1 | 12 ---- updatecli/updatecli.d/awscli.yml | 4 +- updatecli/updatecli.d/azure-cli.yml | 4 +- updatecli/updatecli.d/chocolatey.yml | 4 +- .../updatecli.d/container-structure-test.yml | 4 +- updatecli/updatecli.d/docker-ce.yaml | 5 +- updatecli/updatecli.d/docker-compose.yml | 4 +- updatecli/updatecli.d/git-lfs.yml | 9 +++ updatecli/updatecli.d/github-cli.yml | 4 +- updatecli/updatecli.d/goss.yml | 11 +++- updatecli/updatecli.d/hadolint.yml | 1 + .../updatecli.d/{jq.yml => jq.yml.disabled} | 1 + updatecli/updatecli.d/jx-release-version.yml | 1 + updatecli/updatecli.d/launchable.yml | 1 + updatecli/updatecli.d/nodejs.yml | 4 +- updatecli/updatecli.d/packer.yml | 1 + updatecli/updatecli.d/pwsh.yml | 16 +++++- updatecli/updatecli.d/python3.yml | 8 +++ updatecli/updatecli.d/terraform.yml | 4 +- updatecli/updatecli.d/updatecli.yml | 4 +- updatecli/updatecli.d/vagrant.yml | 8 +++ updatecli/updatecli.d/yq.yml | 57 +++++++++++++++++++ 23 files changed, 147 insertions(+), 62 deletions(-) rename updatecli/updatecli.d/{jq.yml => jq.yml.disabled} (97%) create mode 100644 updatecli/updatecli.d/yq.yml diff --git a/goss/goss-windows.yaml b/goss/goss-windows.yaml index 11ee65766..8901fe45a 100644 --- a/goss/goss-windows.yaml +++ b/goss/goss-windows.yaml @@ -1,155 +1,123 @@ command: Powershell: exec: powershell (Get-Host).Version - exit-status: 0 awscli: exec: aws --version - exit-status: 0 stdout: - - 2.15.0 + - 2.15.2 azurecli: exec: az version - exit-status: 0 stdout: - 2.55.0 bundle: exec: bundle -v - exit-status: 0 chocolatey: exec: choco exit-status: 1 container-structure-test: exec: container-structure-test version - exit-status: 0 stdout: - 1.16.0 default_java: exec: java --version - exit-status: 0 stdout: - 11.0.21+9 docker-ce: exec: docker -v - exit-status: 0 docker_compose: exec: docker-compose -v - exit-status: 0 stdout: - 2.23.3 gh_cli: exec: gh version - exit-status: 0 stdout: - - 2.40.0 + - 2.40.1 git_lfs: exec: git-lfs version - exit-status: 0 stdout: - - 3.4.0 + - 3.4.1 goss: exec: goss -version - exit-status: 0 stdout: - 0.4.4 hadolint: exec: hadolint --version - exit-status: 0 stdout: - 2.12.0 jdk11: exec: C:\tools\jdk-11\bin\java --version - exit-status: 0 stdout: - 11.0.21+9 jdk17: exec: C:\tools\jdk-17\bin\java --version - exit-status: 0 stdout: - 17.0.8.1+1 jdk21: exec: C:\tools\jdk-21\bin\java --version - exit-status: 0 stdout: - 21.0.1+12 jdk8: exec: C:\tools\jdk-8\bin\java -version - exit-status: 0 stderr: - 1.8.0_392 jq: exec: jq --version - exit-status: 0 stdout: - jq-1.6 jx-release-version: exec: jx-release-version -version - exit-status: 0 stdout: - 2.7.0 kubectl: exec: kubectl version --client - exit-status: 0 stdout: - 1.23.13 launchable: exec: launchable --version - exit-status: 0 stdout: - 1.66.0 make: exec: make -version - exit-status: 0 netlify-deploy: exec: netlify-deploy --help - exit-status: 0 nodejs: exec: node --version - exit-status: 0 stdout: - 18.18.2 packer: exec: packer --version - exit-status: 0 stdout: - - 1.9.4 + - 1.10.0 pwsh: exec: pwsh -command "(Get-Host).Version" - exit-status: 0 stdout: - /7.*4.*0/ python3: exec: python --version - exit-status: 0 stdout: - 3.12.1 ruby: exec: ruby -v - exit-status: 0 stdout: - 2.6.10 terraform: exec: terraform -v - exit-status: 0 stdout: - - 1.6.5 + - 1.6.6 trivy: exec: trivy --version - exit-status: 0 stdout: - 0.47.0 updatecli: exec: updatecli version - exit-status: 0 stderr: - 0.69.0 vagrant: exec: vagrant --version - exit-status: 0 stdout: - 2.4.0 yq: exec: yq --version - exit-status: 0 stdout: - 4.25.3 file: diff --git a/provisioning/windows-provision.ps1 b/provisioning/windows-provision.ps1 index 2f5281fa9..013324845 100644 --- a/provisioning/windows-provision.ps1 +++ b/provisioning/windows-provision.ps1 @@ -359,15 +359,3 @@ Select-Object -Property DeviceID, DriveType, VolumeName, Write-Host "== Patch(s) installed" Get-HotFix | Format-Table -Property HotFixID, Description, InstalledOn - -Write-Host "== Sanity Check of installed tools" -Write-Host "- Path environment" -Write-Host (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path -foreach($k in $downloads.Keys) { - $download = $downloads[$k] - if($download.ContainsKey('sanityCheck')) { - Write-Host "- Sanity check for $k" - Invoke-Command $download['sanityCheck'] - } -} -Write-Host "== End of Sanity Check" diff --git a/updatecli/updatecli.d/awscli.yml b/updatecli/updatecli.d/awscli.yml index 4c042bb4f..54c4c255a 100644 --- a/updatecli/updatecli.d/awscli.yml +++ b/updatecli/updatecli.d/awscli.yml @@ -47,7 +47,9 @@ targets: name: Update the `aws` CLI version in the goss test kind: yaml spec: - file: "goss/goss-linux.yaml" + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.awscli.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/azure-cli.yml b/updatecli/updatecli.d/azure-cli.yml index 1ecbf3b42..ff83539eb 100644 --- a/updatecli/updatecli.d/azure-cli.yml +++ b/updatecli/updatecli.d/azure-cli.yml @@ -42,7 +42,9 @@ targets: name: Update the `azure-cli` version in the goss test kind: yaml spec: - file: "goss/goss-linux.yaml" + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.azurecli.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/chocolatey.yml b/updatecli/updatecli.d/chocolatey.yml index e69f27c63..b469313e0 100644 --- a/updatecli/updatecli.d/chocolatey.yml +++ b/updatecli/updatecli.d/chocolatey.yml @@ -33,8 +33,8 @@ targets: sourceid: lastReleaseVersion kind: yaml spec: - file: "provisioning/tools-versions.yml" - key: "chocolatey_version" + file: provisioning/tools-versions.yml + key: $.chocolatey_version scmid: default actions: diff --git a/updatecli/updatecli.d/container-structure-test.yml b/updatecli/updatecli.d/container-structure-test.yml index 8f8232f4c..ebcdaff5a 100644 --- a/updatecli/updatecli.d/container-structure-test.yml +++ b/updatecli/updatecli.d/container-structure-test.yml @@ -40,7 +40,9 @@ targets: name: Update the `container-structure-test` version in the goss test kind: yaml spec: - file: "goss/goss-linux.yaml" + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.container-structure-test.stdout[0] transformers: - addprefix: "v" diff --git a/updatecli/updatecli.d/docker-ce.yaml b/updatecli/updatecli.d/docker-ce.yaml index 023c2a043..345eadc58 100644 --- a/updatecli/updatecli.d/docker-ce.yaml +++ b/updatecli/updatecli.d/docker-ce.yaml @@ -42,7 +42,10 @@ targets: name: Update the Docker CE version in the Linux goss test harness kind: yaml spec: - file: goss/goss-linux.yaml + files: + - goss/goss-linux.yaml + # TODO check if version is needed on windows + # - goss/goss-windows.yaml key: $.command.docker-ce.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/docker-compose.yml b/updatecli/updatecli.d/docker-compose.yml index 432695d5f..61d2d706a 100644 --- a/updatecli/updatecli.d/docker-compose.yml +++ b/updatecli/updatecli.d/docker-compose.yml @@ -39,7 +39,9 @@ targets: name: Update the `DockerCompose` version in the goss test kind: yaml spec: - file: "goss/goss-linux.yaml" + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.docker_compose.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/git-lfs.yml b/updatecli/updatecli.d/git-lfs.yml index 764ac850a..cec3613fe 100644 --- a/updatecli/updatecli.d/git-lfs.yml +++ b/updatecli/updatecli.d/git-lfs.yml @@ -35,6 +35,15 @@ targets: file: "provisioning/tools-versions.yml" key: "git_lfs_version" scmid: default + updateVersionInGoss: + name: Update the Git-LFS version in the Goss test harness + kind: yaml + spec: + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml + key: $.command.git_lfs.stdout[0] + scmid: default actions: default: diff --git a/updatecli/updatecli.d/github-cli.yml b/updatecli/updatecli.d/github-cli.yml index bc8b67242..e5fd2700e 100644 --- a/updatecli/updatecli.d/github-cli.yml +++ b/updatecli/updatecli.d/github-cli.yml @@ -40,7 +40,9 @@ targets: name: Update the `GitHub CLI (gh)` version in the goss test kind: yaml spec: - file: "goss/goss-linux.yaml" + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.gh_cli.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/goss.yml b/updatecli/updatecli.d/goss.yml index ad216129e..cd3ae395c 100644 --- a/updatecli/updatecli.d/goss.yml +++ b/updatecli/updatecli.d/goss.yml @@ -29,12 +29,21 @@ sources: targets: updateToolVersion: - name: Update the Goss tool version + name: Update the `Goss` tool version kind: yaml spec: file: provisioning/tools-versions.yml key: $.goss_version scmid: default + updateVersionInGoss: + name: Update the `Goss` version in the goss test + kind: yaml + spec: + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml + key: $.command.goss.stdout[0] + scmid: default actions: default: diff --git a/updatecli/updatecli.d/hadolint.yml b/updatecli/updatecli.d/hadolint.yml index 99f013ebe..9d205f6b6 100644 --- a/updatecli/updatecli.d/hadolint.yml +++ b/updatecli/updatecli.d/hadolint.yml @@ -42,6 +42,7 @@ targets: spec: files: - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.hadolint.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/jq.yml b/updatecli/updatecli.d/jq.yml.disabled similarity index 97% rename from updatecli/updatecli.d/jq.yml rename to updatecli/updatecli.d/jq.yml.disabled index 5d15c04de..86896eb8a 100644 --- a/updatecli/updatecli.d/jq.yml +++ b/updatecli/updatecli.d/jq.yml.disabled @@ -44,6 +44,7 @@ targets: spec: files: - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.jq.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/jx-release-version.yml b/updatecli/updatecli.d/jx-release-version.yml index e81931000..0e81db34d 100644 --- a/updatecli/updatecli.d/jx-release-version.yml +++ b/updatecli/updatecli.d/jx-release-version.yml @@ -42,6 +42,7 @@ targets: spec: files: - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.jx-release-version.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/launchable.yml b/updatecli/updatecli.d/launchable.yml index 352d28b14..d2d7dd7e9 100644 --- a/updatecli/updatecli.d/launchable.yml +++ b/updatecli/updatecli.d/launchable.yml @@ -42,6 +42,7 @@ targets: spec: files: - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.launchable.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/nodejs.yml b/updatecli/updatecli.d/nodejs.yml index 22c876079..b3b36168e 100644 --- a/updatecli/updatecli.d/nodejs.yml +++ b/updatecli/updatecli.d/nodejs.yml @@ -54,7 +54,9 @@ targets: sourceid: lastReleaseVersion kind: yaml spec: - file: goss/goss-linux.yaml + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.nodejs.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/packer.yml b/updatecli/updatecli.d/packer.yml index d04c763ef..16b4b05ca 100644 --- a/updatecli/updatecli.d/packer.yml +++ b/updatecli/updatecli.d/packer.yml @@ -50,6 +50,7 @@ targets: spec: files: - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.packer.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/pwsh.yml b/updatecli/updatecli.d/pwsh.yml index 695156638..92f3b0549 100644 --- a/updatecli/updatecli.d/pwsh.yml +++ b/updatecli/updatecli.d/pwsh.yml @@ -42,13 +42,27 @@ conditions: targets: updateVersion: - name: "Update the pwsh version in the provisioning/tools-versions.yml file" + name: "Update the `Pwsh` version in the provisioning/tools-versions.yml file" sourceid: lastReleaseVersion kind: yaml spec: file: "provisioning/tools-versions.yml" key: "windows_pwsh_version" scmid: default + updatePwshVersionInGoss: + name: Update the `Pwsh` version in the goss test + kind: yaml + spec: + files: + - "goss/goss-windows.yaml" + key: $.command.pwsh.stdout[0] + transformers: + - replacer: + from: "." + to: ".*" + - addprefix: "/" + - addsuffix: "/" + scmid: default actions: default: diff --git a/updatecli/updatecli.d/python3.yml b/updatecli/updatecli.d/python3.yml index eec939060..f4b852e23 100644 --- a/updatecli/updatecli.d/python3.yml +++ b/updatecli/updatecli.d/python3.yml @@ -39,6 +39,14 @@ targets: file: "provisioning/tools-versions.yml" key: "$.python3_version" scmid: default + updatePackerVersionInGoss: + name: Update the `python3` version in the goss test + kind: yaml + spec: + files: + - "goss/goss-windows.yaml" #fixed only on windows + key: $.command.python3.stdout[0] + scmid: default actions: default: diff --git a/updatecli/updatecli.d/terraform.yml b/updatecli/updatecli.d/terraform.yml index d01080ff5..a8e92280a 100644 --- a/updatecli/updatecli.d/terraform.yml +++ b/updatecli/updatecli.d/terraform.yml @@ -47,7 +47,9 @@ targets: name: "Update the `TERRAFORM` version in the goss test" kind: yaml spec: - file: goss/goss-linux.yaml + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.terraform.stdout[0] scmid: default diff --git a/updatecli/updatecli.d/updatecli.yml b/updatecli/updatecli.d/updatecli.yml index cb13e27b6..e1d93e9b9 100644 --- a/updatecli/updatecli.d/updatecli.yml +++ b/updatecli/updatecli.d/updatecli.yml @@ -40,7 +40,9 @@ targets: name: "Update the `updatecli` version in the goss test" kind: yaml spec: - file: goss/goss-linux.yaml + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml key: $.command.updatecli.stderr[0] scmid: default diff --git a/updatecli/updatecli.d/vagrant.yml b/updatecli/updatecli.d/vagrant.yml index 1d703337d..0509fa6e2 100644 --- a/updatecli/updatecli.d/vagrant.yml +++ b/updatecli/updatecli.d/vagrant.yml @@ -45,6 +45,14 @@ targets: file: "provisioning/tools-versions.yml" key: "$.vagrant_version" scmid: default + updateVersionInGoss: + name: "Update the `vagrant` version in the goss test" + kind: yaml + spec: + files: + - goss/goss-windows.yaml # windows only as the linux arm64 vagrant version is not pinned + key: $.command.vagrant.stdout[0] + scmid: default actions: default: diff --git a/updatecli/updatecli.d/yq.yml b/updatecli/updatecli.d/yq.yml new file mode 100644 index 000000000..3a7ea6108 --- /dev/null +++ b/updatecli/updatecli.d/yq.yml @@ -0,0 +1,57 @@ +--- +name: Bump `yq` version + +scms: + default: + kind: github + spec: + user: "{{ .github.user }}" + email: "{{ .github.email }}" + owner: "{{ .github.owner }}" + repository: "{{ .github.repository }}" + token: "{{ requiredEnv .github.token }}" + username: "{{ .github.username }}" + branch: "{{ .github.branch }}" + +sources: + lastReleaseVersion: + kind: githubrelease + name: Get the latest yq version + spec: + owner: "mikefarah" + repository: "yq" + token: "{{ requiredEnv .github.token }}" + username: "{{ .github.username }}" + versionfilter: + kind: latest + transformers: + - trimprefix: v + +targets: + updateVersion: + name: Update the `yq` version in the provision-env.yml file + sourceid: lastReleaseVersion + kind: yaml + spec: + file: "provisioning/tools-versions.yml" + key: "$.yq_version" + scmid: default + updateVersionInGoss: + name: "Update the `yq` version in the goss test" + kind: yaml + spec: + files: + - goss/goss-linux.yaml + - goss/goss-windows.yaml + key: $.command.yq.stdout[0] + scmid: default + +actions: + default: + kind: github/pullrequest + scmid: default + title: Bump the `yq` CLI version to {{ source "lastReleaseVersion" }} + spec: + labels: + - enhancement + - yq