From 9d88b966ca9389d887617fa9cb7d587b379d6bb1 Mon Sep 17 00:00:00 2001 From: Damien Duportal Date: Fri, 20 Oct 2023 16:17:10 +0200 Subject: [PATCH] feat: add NodeJS to windows and track its version (#864) Signed-off-by: Damien Duportal --- provisioning/windows-provision.ps1 | 1 + updatecli/updatecli.d/nodejs.yml | 61 ++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 updatecli/updatecli.d/nodejs.yml diff --git a/provisioning/windows-provision.ps1 b/provisioning/windows-provision.ps1 index 830e0ef07..8340e5e63 100644 --- a/provisioning/windows-provision.ps1 +++ b/provisioning/windows-provision.ps1 @@ -310,6 +310,7 @@ $downloads = [ordered]@{ & "choco.exe" install datadog-agent --yes --no-progress --limit-output --fail-on-error-output; & "choco.exe" install vcredist2015 --yes --no-progress --limit-output --fail-on-error-output; & "choco.exe" install trivy --yes --no-progress --limit-output --fail-on-error-output --version "${env:TRIVY_VERSION}"; + & "choco.exe" install nodejs.install --yes --no-progress --limit-output --fail-on-error-output --version "${env:NODEJS_VERSION}"; # Installation of python3 for Launchable & "choco.exe" install python3 --yes --no-progress --limit-output --fail-on-error-output --version "${env:PYTHON3_VERSION}"; # Installation of Launchable globally (no other python tool) diff --git a/updatecli/updatecli.d/nodejs.yml b/updatecli/updatecli.d/nodejs.yml new file mode 100644 index 000000000..ca9805b4a --- /dev/null +++ b/updatecli/updatecli.d/nodejs.yml @@ -0,0 +1,61 @@ +--- +name: Bump NodeJS 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 NodeJS version + spec: + owner: nodejs + repository: node + token: "{{ requiredEnv .github.token }}" + username: "{{ .github.username }}" + versionfilter: + kind: regex + pattern: v18.(\d*).(\d*) + transformers: + - trimprefix: v + +conditions: + checkForPackage: + kind: shell + disablesourceinput: true # Do not pass source as argument to the command line + spec: + command: curl --fail --silent --show-error --location --head https://nodejs.org/dist/v{{ source "lastReleaseVersion" }}/node-v{{ source "lastReleaseVersion" }}.tar.gz + checkForChocolateyPackage: + kind: shell + disablesourceinput: true # Do not pass source as argument to the command line + spec: + command: curl --silent --show-error --location --fail --output /dev/null https://community.chocolatey.org/packages/nodejs.install/{{ source "lastReleaseVersion" }} + +targets: + updateVersion: + name: Update the NodeJS version in provisioning environment + sourceid: lastReleaseVersion + kind: yaml + spec: + file: provisioning/tools-versions.yml + key: nodejs_version + scmid: default + +actions: + default: + kind: github/pullrequest + title: Bump NodeJS version to {{ source "lastReleaseVersion" }} + scmid: default + spec: + labels: + - enhancement + - nodejs