From 18766e66459194b7d44db0ee29cae867a7522429 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 19 Nov 2024 10:53:23 +0200 Subject: [PATCH 01/79] initial commit Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 057be6f..30f3399 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -16,7 +16,7 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - run-pytest: + run-tests: needs: run-provisioner-workflow runs-on: ${{ needs.run-provisioner-workflow.outputs.instance_label }} steps: From 9e13fb6b4e8ec85283fe15deab95f4857ddb4cd1 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 19 Nov 2024 10:55:44 +0200 Subject: [PATCH 02/79] added execute tests command Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 30f3399..4440d1f 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -36,6 +36,7 @@ jobs: - name: Run tests run: | echo "Executing tests" + npx playwright test remove-ec2-runner: needs: [ run-provisioner-workflow,execute-script ] From 7f1e8f946bb677eec1c0621c6ad6688314c0162d Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 19 Nov 2024 10:57:13 +0200 Subject: [PATCH 03/79] fixed wrong name Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 4440d1f..e5cda65 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -39,7 +39,7 @@ jobs: npx playwright test remove-ec2-runner: - needs: [ run-provisioner-workflow,execute-script ] + needs: [ run-provisioner-workflow,run-tests ] uses: ./.github/workflows/remove-runner.yml with: ec2-instance-id: ${{ needs.run-provisioner-workflow.outputs.ec2-instance-id }} From 3badd741bb2834b469769c6e89e7a66619d9aba4 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 19 Nov 2024 10:59:39 +0200 Subject: [PATCH 04/79] changed github token secret name to GH_RUNNER_API_TOKEN Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index e5cda65..0e0ecba 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -14,7 +14,7 @@ jobs: secrets: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} run-tests: needs: run-provisioner-workflow From 96034ef4e6c95446adf34566cc1bec1347c990dd Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 19 Nov 2024 11:30:44 +0200 Subject: [PATCH 05/79] install vscode script Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 0e0ecba..72209f8 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -20,22 +20,36 @@ jobs: needs: run-provisioner-workflow runs-on: ${{ needs.run-provisioner-workflow.outputs.instance_label }} steps: - - name: Install vscode + - name: Install dependencies run: | - echo "installing vscode" + sudo apt-get update + sudo apt-get install -y wget apt-transport-https + + - name: Install Visual Studio Code + run: | + wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg + sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/ + sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' + rm -f packages.microsoft.gpg + sudo apt-get update + sudo apt-get install -y code + + - name: Check VSCode installation + run: code --version + - name: Clone kai-ci repo run: | mkdir ./kai-ci-temp cd ./kai-ci-temp git clone https://github.com/konveyor/kai-ci.git cd kai-ci - echo "repo cloned" + - name: Install npm dependencies run: | npm install . + - name: Run tests run: | - echo "Executing tests" npx playwright test remove-ec2-runner: From d8000157e0efdcdcfc66bfa66bd52b709e4ad8ac Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 19 Nov 2024 11:50:04 +0200 Subject: [PATCH 06/79] run `remove-ec2-runner` even if the run-tests failed Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 72209f8..957176f 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -54,6 +54,7 @@ jobs: remove-ec2-runner: needs: [ run-provisioner-workflow,run-tests ] + if: always() uses: ./.github/workflows/remove-runner.yml with: ec2-instance-id: ${{ needs.run-provisioner-workflow.outputs.ec2-instance-id }} From a700c01248e8c415642c434b663c2084918836c7 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 19 Nov 2024 12:53:53 +0200 Subject: [PATCH 07/79] fix token name Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 957176f..0f7d271 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -62,4 +62,4 @@ jobs: secrets: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} \ No newline at end of file + github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} \ No newline at end of file From 600267d13b47cde9bb380a636e425324a92a4de3 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 19 Nov 2024 16:39:00 +0200 Subject: [PATCH 08/79] change script Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 0f7d271..ec04400 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -20,19 +20,11 @@ jobs: needs: run-provisioner-workflow runs-on: ${{ needs.run-provisioner-workflow.outputs.instance_label }} steps: - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y wget apt-transport-https - name: Install Visual Studio Code run: | - wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg - sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/ - sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' - rm -f packages.microsoft.gpg - sudo apt-get update - sudo apt-get install -y code + Invoke-WebRequest -Uri "https://update.code.visualstudio.com/latest/win32-x64-user/stable" -OutFile "$env:TEMP\vscode-installer.exe" + Start-Process -FilePath "$env:TEMP\vscode-installer.exe" -ArgumentList "/silent" -Wait - name: Check VSCode installation run: code --version From 0d3d3a2b7ca78b3da3c897a1831426faef5f48e9 Mon Sep 17 00:00:00 2001 From: midays Date: Thu, 21 Nov 2024 14:24:47 +0200 Subject: [PATCH 09/79] change script again Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index ec04400..f2b6c94 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,12 +21,13 @@ jobs: runs-on: ${{ needs.run-provisioner-workflow.outputs.instance_label }} steps: - - name: Install Visual Studio Code + - name: Install Visual Studio Code using winget + shell: pwsh run: | - Invoke-WebRequest -Uri "https://update.code.visualstudio.com/latest/win32-x64-user/stable" -OutFile "$env:TEMP\vscode-installer.exe" - Start-Process -FilePath "$env:TEMP\vscode-installer.exe" -ArgumentList "/silent" -Wait + winget install -e --id Microsoft.VisualStudioCode -h --silent - name: Check VSCode installation + shell: pwsh run: code --version - name: Clone kai-ci repo From 1eaa3070397d2131e2c776e98517e3e7d8870dd5 Mon Sep 17 00:00:00 2001 From: midays Date: Thu, 21 Nov 2024 15:25:58 +0200 Subject: [PATCH 10/79] add shell specification Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index f2b6c94..b848afd 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -22,12 +22,12 @@ jobs: steps: - name: Install Visual Studio Code using winget - shell: pwsh + shell: powershell run: | winget install -e --id Microsoft.VisualStudioCode -h --silent - name: Check VSCode installation - shell: pwsh + shell: powershell run: code --version - name: Clone kai-ci repo From 8e7c2b2bd45efe96c9a24ff146e813b9a06bbe6f Mon Sep 17 00:00:00 2001 From: midays Date: Thu, 21 Nov 2024 16:19:27 +0200 Subject: [PATCH 11/79] try different installation way Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index b848afd..8ca3c54 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,10 +21,12 @@ jobs: runs-on: ${{ needs.run-provisioner-workflow.outputs.instance_label }} steps: - - name: Install Visual Studio Code using winget + - name: Install Visual Studio Code shell: powershell run: | - winget install -e --id Microsoft.VisualStudioCode -h --silent + $InstallerPath = "C:\vscode-installer.exe" + Invoke-WebRequest -Uri "https://update.code.visualstudio.com/latest/win32-x64-user/stable" -OutFile $InstallerPath + Start-Process -FilePath $InstallerPath -ArgumentList "/silent" -Wait - name: Check VSCode installation shell: powershell From 6ecd9eb2e5b490d4413bc74d2d60aa9a0b0c08ba Mon Sep 17 00:00:00 2001 From: midays Date: Thu, 21 Nov 2024 17:37:53 +0200 Subject: [PATCH 12/79] added max retries Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 8ca3c54..dbc1cc1 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -25,8 +25,24 @@ jobs: shell: powershell run: | $InstallerPath = "C:\vscode-installer.exe" - Invoke-WebRequest -Uri "https://update.code.visualstudio.com/latest/win32-x64-user/stable" -OutFile $InstallerPath - Start-Process -FilePath $InstallerPath -ArgumentList "/silent" -Wait + $Uri = "https://update.code.visualstudio.com/latest/win32-x64-user/stable" + $RetryCount = 0 + $MaxRetries = 3 + $Success = $false + + while (-not $Success -and $RetryCount -lt $MaxRetries) { + try { + Invoke-WebRequest -Uri $Uri -OutFile $InstallerPath -TimeoutSec 60 + $Success = $true + } catch { + $RetryCount++ + Write-Output "Download failed. Retry $RetryCount of $MaxRetries..." + Start-Sleep -Seconds 10 + } + } + if (-not $Success) { + throw "Failed to download VSCode installer after $MaxRetries attempts." + } - name: Check VSCode installation shell: powershell From ef106ab0ec9c2b3bc8a8f2121b02e7a5522acac6 Mon Sep 17 00:00:00 2001 From: midays Date: Thu, 21 Nov 2024 17:56:55 +0200 Subject: [PATCH 13/79] install winget and try to use it to install vscode Signed-off-by: midays --- .github/workflows/provision-runner.yml | 13 ++++++++++++- .github/workflows/windows-nightly-ci.yml | 20 +------------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 70a51d4..64d3481 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -78,4 +78,15 @@ jobs: - name: Output EC2 Instance ID run: | echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" - echo "Label : ${{ steps.ec2.outputs.label }}" \ No newline at end of file + echo "Label : ${{ steps.ec2.outputs.label }}" + + - name: Install winget (Windows only) + if: ${{ inputs.ec2-os-type == 'windows' }} + shell: powershell + run: | + $InstallerUrl = "https://aka.ms/MicrosoftAppInstaller" + $InstallerPath = "C:\appinstaller.appxbundle" + Invoke-WebRequest -Uri $InstallerUrl -OutFile $InstallerPath + Add-AppxPackage -Path $InstallerPath + # Wait for winget to be available + Start-Sleep -Seconds 10 \ No newline at end of file diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index dbc1cc1..0dac793 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -24,25 +24,7 @@ jobs: - name: Install Visual Studio Code shell: powershell run: | - $InstallerPath = "C:\vscode-installer.exe" - $Uri = "https://update.code.visualstudio.com/latest/win32-x64-user/stable" - $RetryCount = 0 - $MaxRetries = 3 - $Success = $false - - while (-not $Success -and $RetryCount -lt $MaxRetries) { - try { - Invoke-WebRequest -Uri $Uri -OutFile $InstallerPath -TimeoutSec 60 - $Success = $true - } catch { - $RetryCount++ - Write-Output "Download failed. Retry $RetryCount of $MaxRetries..." - Start-Sleep -Seconds 10 - } - } - if (-not $Success) { - throw "Failed to download VSCode installer after $MaxRetries attempts." - } + winget install -e --id Microsoft.VisualStudioCode - name: Check VSCode installation shell: powershell From 5ee2b32b58f78cbb2f699aaff6e5849fce1f163c Mon Sep 17 00:00:00 2001 From: midays Date: Sat, 23 Nov 2024 15:55:30 +0200 Subject: [PATCH 14/79] remove winget installation, assuming vscode is already installed Signed-off-by: midays --- .github/workflows/provision-runner.yml | 13 +------------ .github/workflows/windows-nightly-ci.yml | 5 ----- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 64d3481..70a51d4 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -78,15 +78,4 @@ jobs: - name: Output EC2 Instance ID run: | echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" - echo "Label : ${{ steps.ec2.outputs.label }}" - - - name: Install winget (Windows only) - if: ${{ inputs.ec2-os-type == 'windows' }} - shell: powershell - run: | - $InstallerUrl = "https://aka.ms/MicrosoftAppInstaller" - $InstallerPath = "C:\appinstaller.appxbundle" - Invoke-WebRequest -Uri $InstallerUrl -OutFile $InstallerPath - Add-AppxPackage -Path $InstallerPath - # Wait for winget to be available - Start-Sleep -Seconds 10 \ No newline at end of file + echo "Label : ${{ steps.ec2.outputs.label }}" \ No newline at end of file diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 0dac793..df4c724 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,11 +21,6 @@ jobs: runs-on: ${{ needs.run-provisioner-workflow.outputs.instance_label }} steps: - - name: Install Visual Studio Code - shell: powershell - run: | - winget install -e --id Microsoft.VisualStudioCode - - name: Check VSCode installation shell: powershell run: code --version From f7f27204febd77be94e5a16e7c00006e3dfc559a Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 01:53:28 +0200 Subject: [PATCH 15/79] print the env variable name to test if vscode is found and recognizable by the runner Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index df4c724..9ef025d 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,11 +21,16 @@ jobs: runs-on: ${{ needs.run-provisioner-workflow.outputs.instance_label }} steps: + - name: Check Env PATH variable + shell: pwsh + run: echo $env:PATH + - name: Check VSCode installation - shell: powershell + shell: pwsh run: code --version - name: Clone kai-ci repo + shell: pwsh run: | mkdir ./kai-ci-temp cd ./kai-ci-temp @@ -33,10 +38,12 @@ jobs: cd kai-ci - name: Install npm dependencies + shell: pwsh run: | npm install . - name: Run tests + shell: pwsh run: | npx playwright test From d8a0863be338208a77f38b34260db69b58b31a67 Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 02:02:00 +0200 Subject: [PATCH 16/79] change pwsh to powershell Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 9ef025d..a55d308 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -22,15 +22,15 @@ jobs: steps: - name: Check Env PATH variable - shell: pwsh + shell: powershell run: echo $env:PATH - name: Check VSCode installation - shell: pwsh + shell: powershell run: code --version - name: Clone kai-ci repo - shell: pwsh + shell: powershell run: | mkdir ./kai-ci-temp cd ./kai-ci-temp @@ -38,12 +38,12 @@ jobs: cd kai-ci - name: Install npm dependencies - shell: pwsh + shell: powershell run: | npm install . - name: Run tests - shell: pwsh + shell: powershell run: | npx playwright test From 70af6f412c4d57139cd5d0b1f601c9a9e2b23dbc Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 02:10:41 +0200 Subject: [PATCH 17/79] don't remove the vm [temp, will be removed manually, to test vscode installation directory] Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index a55d308..45b804d 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -47,14 +47,14 @@ jobs: run: | npx playwright test - remove-ec2-runner: - needs: [ run-provisioner-workflow,run-tests ] - if: always() - uses: ./.github/workflows/remove-runner.yml - with: - ec2-instance-id: ${{ needs.run-provisioner-workflow.outputs.ec2-instance-id }} - ec2-runner-label: ${{ needs.run-provisioner-workflow.outputs.instance_label }} - secrets: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} \ No newline at end of file +# remove-ec2-runner: +# needs: [ run-provisioner-workflow,run-tests ] +# if: always() +# uses: ./.github/workflows/remove-runner.yml +# with: +# ec2-instance-id: ${{ needs.run-provisioner-workflow.outputs.ec2-instance-id }} +# ec2-runner-label: ${{ needs.run-provisioner-workflow.outputs.instance_label }} +# secrets: +# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} +# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} +# github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} \ No newline at end of file From d913f7795e6852298caf0e9fb285783c9c969950 Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 02:11:09 +0200 Subject: [PATCH 18/79] Revert "don't remove the vm [temp, will be removed manually, to test vscode installation directory]" This reverts commit 70af6f412c4d57139cd5d0b1f601c9a9e2b23dbc. --- .github/workflows/windows-nightly-ci.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 45b804d..a55d308 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -47,14 +47,14 @@ jobs: run: | npx playwright test -# remove-ec2-runner: -# needs: [ run-provisioner-workflow,run-tests ] -# if: always() -# uses: ./.github/workflows/remove-runner.yml -# with: -# ec2-instance-id: ${{ needs.run-provisioner-workflow.outputs.ec2-instance-id }} -# ec2-runner-label: ${{ needs.run-provisioner-workflow.outputs.instance_label }} -# secrets: -# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} -# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} -# github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} \ No newline at end of file + remove-ec2-runner: + needs: [ run-provisioner-workflow,run-tests ] + if: always() + uses: ./.github/workflows/remove-runner.yml + with: + ec2-instance-id: ${{ needs.run-provisioner-workflow.outputs.ec2-instance-id }} + ec2-runner-label: ${{ needs.run-provisioner-workflow.outputs.instance_label }} + secrets: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} \ No newline at end of file From c7c4e452c6989210c5e374a3d79993f4216ea67a Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 02:11:23 +0200 Subject: [PATCH 19/79] don't remove the vm [temp, will be removed manually, to test vscode installation directory] Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index a55d308..45b804d 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -47,14 +47,14 @@ jobs: run: | npx playwright test - remove-ec2-runner: - needs: [ run-provisioner-workflow,run-tests ] - if: always() - uses: ./.github/workflows/remove-runner.yml - with: - ec2-instance-id: ${{ needs.run-provisioner-workflow.outputs.ec2-instance-id }} - ec2-runner-label: ${{ needs.run-provisioner-workflow.outputs.instance_label }} - secrets: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} \ No newline at end of file +# remove-ec2-runner: +# needs: [ run-provisioner-workflow,run-tests ] +# if: always() +# uses: ./.github/workflows/remove-runner.yml +# with: +# ec2-instance-id: ${{ needs.run-provisioner-workflow.outputs.ec2-instance-id }} +# ec2-runner-label: ${{ needs.run-provisioner-workflow.outputs.instance_label }} +# secrets: +# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} +# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} +# github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} \ No newline at end of file From c45068adcf08b470f7995882c4e2db67c3e96b56 Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 02:44:30 +0200 Subject: [PATCH 20/79] stop instance after use, do initial installation Signed-off-by: midays --- .github/workflows/provision-runner.yml | 23 ++++++++++++++++- .github/workflows/windows-nightly-ci.yml | 33 ++++++++++++++---------- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 70a51d4..7a1b83d 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -78,4 +78,25 @@ jobs: - name: Output EC2 Instance ID run: | echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" - echo "Label : ${{ steps.ec2.outputs.label }}" \ No newline at end of file + echo "Label : ${{ steps.ec2.outputs.label }}" + + - name: Install Chocolatey + run: | + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + shell: powershell + + - name: Install VSCode + run: choco install vscode -y + shell: powershell + + - name: Install Node.js + run: choco install nodejs -y + shell: powershell + + - name: Verify Installations + run: | + code --version + node --version + shell: powershell \ No newline at end of file diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 45b804d..85f94ff 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -3,7 +3,7 @@ name: Provision Windows VM using reusable workflow on: [push] jobs: - run-provisioner-workflow: + start-ec2-instance: uses: ./.github/workflows/provision-runner.yml with: ec2-image-id: ami-0b7d4973163feb944 @@ -17,10 +17,15 @@ jobs: github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} run-tests: - needs: run-provisioner-workflow - runs-on: ${{ needs.run-provisioner-workflow.outputs.instance_label }} + needs: start-ec2-instance + runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: + - name: Add VSCode to PATH + run: | + $env:PATH = "C:\Program Files\Microsoft VS Code;$env:PATH" + shell: powershell + - name: Check Env PATH variable shell: powershell run: echo $env:PATH @@ -47,14 +52,14 @@ jobs: run: | npx playwright test -# remove-ec2-runner: -# needs: [ run-provisioner-workflow,run-tests ] -# if: always() -# uses: ./.github/workflows/remove-runner.yml -# with: -# ec2-instance-id: ${{ needs.run-provisioner-workflow.outputs.ec2-instance-id }} -# ec2-runner-label: ${{ needs.run-provisioner-workflow.outputs.instance_label }} -# secrets: -# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} -# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} -# github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} \ No newline at end of file + stop-ec2-instance: + needs: [ start-ec2-instance,run-tests ] + if: always() + uses: ./.github/workflows/remove-runner.yml + with: + ec2-instance-id: ${{ needs.start-ec2-instance.outputs.ec2-instance-id }} + ec2-runner-label: ${{ needs.start-ec2-instance.outputs.instance_label }} + secrets: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} \ No newline at end of file From c889e5b19f26c24e9df88dc3499f2d722f243bff Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 02:54:13 +0200 Subject: [PATCH 21/79] move installation Signed-off-by: midays --- .github/workflows/provision-runner.yml | 23 +--------------------- .github/workflows/windows-nightly-ci.yml | 25 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 7a1b83d..70a51d4 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -78,25 +78,4 @@ jobs: - name: Output EC2 Instance ID run: | echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" - echo "Label : ${{ steps.ec2.outputs.label }}" - - - name: Install Chocolatey - run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - shell: powershell - - - name: Install VSCode - run: choco install vscode -y - shell: powershell - - - name: Install Node.js - run: choco install nodejs -y - shell: powershell - - - name: Verify Installations - run: | - code --version - node --version - shell: powershell \ No newline at end of file + echo "Label : ${{ steps.ec2.outputs.label }}" \ No newline at end of file diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 85f94ff..6fac0e5 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,11 +21,32 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: - - name: Add VSCode to PATH + - name: Install Chocolatey run: | - $env:PATH = "C:\Program Files\Microsoft VS Code;$env:PATH" + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) shell: powershell + - name: Install VSCode + run: choco install vscode -y + shell: powershell + + - name: Install Node.js + run: choco install nodejs -y + shell: powershell + + - name: Verify Installations + run: | + code --version + node --version + shell: powershell + +# - name: Add VSCode to PATH +# run: | +# $env:PATH = "C:\Program Files\Microsoft VS Code;$env:PATH" +# shell: powershell + - name: Check Env PATH variable shell: powershell run: echo $env:PATH From a0e3ade6cd8586b431502e8be16b3d00c15ef150 Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 02:54:44 +0200 Subject: [PATCH 22/79] Revert "move installation" This reverts commit c889e5b19f26c24e9df88dc3499f2d722f243bff. --- .github/workflows/provision-runner.yml | 23 +++++++++++++++++++++- .github/workflows/windows-nightly-ci.yml | 25 ++---------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 70a51d4..7a1b83d 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -78,4 +78,25 @@ jobs: - name: Output EC2 Instance ID run: | echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" - echo "Label : ${{ steps.ec2.outputs.label }}" \ No newline at end of file + echo "Label : ${{ steps.ec2.outputs.label }}" + + - name: Install Chocolatey + run: | + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + shell: powershell + + - name: Install VSCode + run: choco install vscode -y + shell: powershell + + - name: Install Node.js + run: choco install nodejs -y + shell: powershell + + - name: Verify Installations + run: | + code --version + node --version + shell: powershell \ No newline at end of file diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 6fac0e5..85f94ff 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,32 +21,11 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: - - name: Install Chocolatey + - name: Add VSCode to PATH run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + $env:PATH = "C:\Program Files\Microsoft VS Code;$env:PATH" shell: powershell - - name: Install VSCode - run: choco install vscode -y - shell: powershell - - - name: Install Node.js - run: choco install nodejs -y - shell: powershell - - - name: Verify Installations - run: | - code --version - node --version - shell: powershell - -# - name: Add VSCode to PATH -# run: | -# $env:PATH = "C:\Program Files\Microsoft VS Code;$env:PATH" -# shell: powershell - - name: Check Env PATH variable shell: powershell run: echo $env:PATH From a54902921c62fac19b278134d6b022e43636c176 Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 02:56:39 +0200 Subject: [PATCH 23/79] move installation Signed-off-by: midays --- .github/workflows/provision-runner.yml | 23 +--------------------- .github/workflows/windows-nightly-ci.yml | 25 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 7a1b83d..70a51d4 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -78,25 +78,4 @@ jobs: - name: Output EC2 Instance ID run: | echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" - echo "Label : ${{ steps.ec2.outputs.label }}" - - - name: Install Chocolatey - run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - shell: powershell - - - name: Install VSCode - run: choco install vscode -y - shell: powershell - - - name: Install Node.js - run: choco install nodejs -y - shell: powershell - - - name: Verify Installations - run: | - code --version - node --version - shell: powershell \ No newline at end of file + echo "Label : ${{ steps.ec2.outputs.label }}" \ No newline at end of file diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 85f94ff..6fac0e5 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,11 +21,32 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: - - name: Add VSCode to PATH + - name: Install Chocolatey run: | - $env:PATH = "C:\Program Files\Microsoft VS Code;$env:PATH" + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) shell: powershell + - name: Install VSCode + run: choco install vscode -y + shell: powershell + + - name: Install Node.js + run: choco install nodejs -y + shell: powershell + + - name: Verify Installations + run: | + code --version + node --version + shell: powershell + +# - name: Add VSCode to PATH +# run: | +# $env:PATH = "C:\Program Files\Microsoft VS Code;$env:PATH" +# shell: powershell + - name: Check Env PATH variable shell: powershell run: echo $env:PATH From a2e23c138544461d647ac3dc9da30fe1210361d5 Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 03:08:22 +0200 Subject: [PATCH 24/79] verify env path Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 6fac0e5..f6beb46 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,26 +21,26 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: - - name: Install Chocolatey - run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - shell: powershell - - - name: Install VSCode - run: choco install vscode -y - shell: powershell - - - name: Install Node.js - run: choco install nodejs -y - shell: powershell - - - name: Verify Installations - run: | - code --version - node --version - shell: powershell +# - name: Install Chocolatey +# run: | +# Set-ExecutionPolicy Bypass -Scope Process -Force; +# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; +# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +# shell: powershell +# +# - name: Install VSCode +# run: choco install vscode -y +# shell: powershell +# +# - name: Install Node.js +# run: choco install nodejs -y +# shell: powershell +# +# - name: Verify Installations +# run: | +# code --version +# node --version +# shell: powershell # - name: Add VSCode to PATH # run: | From fe8dac1cf37ce57c536acbedc52e9d8f7846ee8c Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 03:18:09 +0200 Subject: [PATCH 25/79] Add VSCode to PATH Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index f6beb46..1ed6bc5 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -42,10 +42,10 @@ jobs: # node --version # shell: powershell -# - name: Add VSCode to PATH -# run: | -# $env:PATH = "C:\Program Files\Microsoft VS Code;$env:PATH" -# shell: powershell + - name: Add VSCode to PATH + run: | + $env:PATH = "C:\Program Files\Microsoft VS Code;$env:PATH" + shell: powershell - name: Check Env PATH variable shell: powershell From e42b759077d2bff4ca2e327bc8e64f291c111bec Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 04:47:45 +0200 Subject: [PATCH 26/79] check if installing vscode has affects Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 40 +++++++++++------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 1ed6bc5..7d3039a 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,26 +21,20 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: -# - name: Install Chocolatey -# run: | -# Set-ExecutionPolicy Bypass -Scope Process -Force; -# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; -# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) -# shell: powershell -# -# - name: Install VSCode -# run: choco install vscode -y -# shell: powershell -# -# - name: Install Node.js -# run: choco install nodejs -y -# shell: powershell -# -# - name: Verify Installations -# run: | -# code --version -# node --version -# shell: powershell + - name: Install Chocolatey + run: | + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + shell: powershell + + - name: Install VSCode + run: choco install vscode -y + shell: powershell + + - name: Install Node.js + run: choco install nodejs -y + shell: powershell - name: Add VSCode to PATH run: | @@ -51,9 +45,11 @@ jobs: shell: powershell run: echo $env:PATH - - name: Check VSCode installation + - name: Verify Installation + run: | + code --version + node --version shell: powershell - run: code --version - name: Clone kai-ci repo shell: powershell From 83178fcf8f6d8fcbd7d56e84ee67938cdd8f6f90 Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 13:28:09 +0200 Subject: [PATCH 27/79] refresh environment Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 7d3039a..22fc72a 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -36,9 +36,8 @@ jobs: run: choco install nodejs -y shell: powershell - - name: Add VSCode to PATH - run: | - $env:PATH = "C:\Program Files\Microsoft VS Code;$env:PATH" + - name: Refresh Environment Variables + run: refreshenv shell: powershell - name: Check Env PATH variable From 4a412b6d8ed00e2ee69f82d509da61c9de3c44b6 Mon Sep 17 00:00:00 2001 From: midays Date: Sun, 24 Nov 2024 13:54:52 +0200 Subject: [PATCH 28/79] remove installation, directly check vscode and nodeJS Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 32 +++++++++++------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 22fc72a..65edf78 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,24 +21,20 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: - - name: Install Chocolatey - run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - shell: powershell - - - name: Install VSCode - run: choco install vscode -y - shell: powershell - - - name: Install Node.js - run: choco install nodejs -y - shell: powershell - - - name: Refresh Environment Variables - run: refreshenv - shell: powershell +# - name: Install Chocolatey +# run: | +# Set-ExecutionPolicy Bypass -Scope Process -Force; +# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; +# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +# shell: powershell +# +# - name: Install VSCode +# run: choco install vscode -y +# shell: powershell +# +# - name: Install Node.js +# run: choco install nodejs -y +# shell: powershell - name: Check Env PATH variable shell: powershell From 37db59666fa727667149f42988cbc2f1d32fe6ad Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 13:10:28 +0200 Subject: [PATCH 29/79] check if the full path of the VSCODE works Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 65edf78..1c16e80 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -36,13 +36,18 @@ jobs: # run: choco install nodejs -y # shell: powershell +# - name: Update PATH for VSCode +# shell: powershell +# run: | +# $env:PATH += ";C:\Program Files\Microsoft VS Code\bin" + - name: Check Env PATH variable shell: powershell run: echo $env:PATH - name: Verify Installation run: | - code --version + & "C:\Program Files\Microsoft VS Code\bin\code" --version node --version shell: powershell From 565572641775b67698c753c564e46a694c70bc0a Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 14:03:59 +0200 Subject: [PATCH 30/79] install vscode and check full path Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 36 ++++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 1c16e80..9e6208f 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,25 +21,25 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: -# - name: Install Chocolatey -# run: | -# Set-ExecutionPolicy Bypass -Scope Process -Force; -# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; -# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) -# shell: powershell -# -# - name: Install VSCode -# run: choco install vscode -y -# shell: powershell -# -# - name: Install Node.js -# run: choco install nodejs -y -# shell: powershell + - name: Install Chocolatey + run: | + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + shell: powershell + + - name: Install VSCode + run: choco install vscode -y + shell: powershell -# - name: Update PATH for VSCode -# shell: powershell -# run: | -# $env:PATH += ";C:\Program Files\Microsoft VS Code\bin" + - name: Install Node.js + run: choco install nodejs -y + shell: powershell + + - name: Update PATH for VSCode + shell: powershell + run: | + $env:PATH += ";C:\Program Files\Microsoft VS Code\bin" - name: Check Env PATH variable shell: powershell From 3f07c80ca6d615973389ab826dbcdb984894dd19 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 14:58:42 +0200 Subject: [PATCH 31/79] install node and check full path Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 9e6208f..d88a3ad 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -41,6 +41,10 @@ jobs: run: | $env:PATH += ";C:\Program Files\Microsoft VS Code\bin" +# - name: Refresh PATH after Node.js Installation +# run: refreshenv +# shell: powershell + - name: Check Env PATH variable shell: powershell run: echo $env:PATH @@ -48,7 +52,7 @@ jobs: - name: Verify Installation run: | & "C:\Program Files\Microsoft VS Code\bin\code" --version - node --version + & "C:\Program Files\nodejs\node.exe" --version shell: powershell - name: Clone kai-ci repo From bd6a6bfd43065c6d61a81620b08a70f59f97eec9 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 15:14:27 +0200 Subject: [PATCH 32/79] check without installation Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 38 ++++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index d88a3ad..4bc69b5 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,25 +21,25 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: - - name: Install Chocolatey - run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - shell: powershell - - - name: Install VSCode - run: choco install vscode -y - shell: powershell - - - name: Install Node.js - run: choco install nodejs -y - shell: powershell - - - name: Update PATH for VSCode - shell: powershell - run: | - $env:PATH += ";C:\Program Files\Microsoft VS Code\bin" +# - name: Install Chocolatey +# run: | +# Set-ExecutionPolicy Bypass -Scope Process -Force; +# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; +# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +# shell: powershell +# +# - name: Install VSCode +# run: choco install vscode -y +# shell: powershell +# +# - name: Install Node.js +# run: choco install nodejs -y +# shell: powershell +# +# - name: Update PATH for VSCode +# shell: powershell +# run: | +# $env:PATH += ";C:\Program Files\Microsoft VS Code\bin" # - name: Refresh PATH after Node.js Installation # run: refreshenv From 923d52754b5cae44ad899c5953af1e3d83391f76 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 15:46:55 +0200 Subject: [PATCH 33/79] refresh env PATH var Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 4bc69b5..3931cb2 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,29 +21,29 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: -# - name: Install Chocolatey -# run: | -# Set-ExecutionPolicy Bypass -Scope Process -Force; -# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; -# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) -# shell: powershell -# -# - name: Install VSCode -# run: choco install vscode -y -# shell: powershell -# -# - name: Install Node.js -# run: choco install nodejs -y -# shell: powershell -# -# - name: Update PATH for VSCode -# shell: powershell -# run: | -# $env:PATH += ";C:\Program Files\Microsoft VS Code\bin" + - name: Install Chocolatey + run: | + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + shell: powershell + + - name: Install VSCode + run: choco install vscode -y + shell: powershell + + - name: Install Node.js + run: choco install nodejs -y + shell: powershell -# - name: Refresh PATH after Node.js Installation -# run: refreshenv -# shell: powershell + - name: Update PATH for VSCode + shell: powershell + run: | + $env:PATH += ";C:\Program Files\Microsoft VS Code\bin" + + - name: Refresh PATH after Node.js Installation + run: refreshenv + shell: powershell - name: Check Env PATH variable shell: powershell From 6c91e751f71dc0dd5379234a84d1a71e41c8a03c Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 16:15:23 +0200 Subject: [PATCH 34/79] Add Node.js and VSCode to PATH manually in GitHub Actions workflow - Manually add Node.js (`C:\Program Files\nodejs`) and VSCode (`C:\Program Files\Microsoft VS Code\bin`) to the PATH environment variable after installation. - Ensures both tools are available during subsequent steps in the GitHub Actions workflow. - Handles the absence of automatic PATH update in non-interactive environments like CI. Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 38 +++++++++++++++++------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 3931cb2..dc379f7 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -36,24 +36,42 @@ jobs: run: choco install nodejs -y shell: powershell - - name: Update PATH for VSCode + - name: Add VSCode and Node.js Manually to PATH shell: powershell run: | - $env:PATH += ";C:\Program Files\Microsoft VS Code\bin" - - - name: Refresh PATH after Node.js Installation - run: refreshenv - shell: powershell + $nodePath = 'C:\Program Files\nodejs' + if (-Not (Test-Path $nodePath)) { + Write-Error "Node.js installation path not found at: $nodePath" + exit 1 + } + $env:PATH += ";$nodePath" + + $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' + if (-Not (Test-Path $vscodePath)) { + Write-Error "VSCode installation path not found at: $vscodePath" + exit 1 + } + $env:PATH += ";$vscodePath" + + # Set the updated PATH variable at Machine level + [System.Environment]::SetEnvironmentVariable('PATH', $env:PATH, [System.EnvironmentVariableTarget]::Machine) + echo $env:PATH - name: Check Env PATH variable shell: powershell run: echo $env:PATH - - name: Verify Installation - run: | - & "C:\Program Files\Microsoft VS Code\bin\code" --version - & "C:\Program Files\nodejs\node.exe" --version +# - name: Verify Installation +# run: | +# & "C:\Program Files\Microsoft VS Code\bin\code" --version +# & "C:\Program Files\nodejs\node.exe" --version +# shell: powershell + + - name: Verify VSCode and Node.js Installation shell: powershell + run: | + code --version + node --version - name: Clone kai-ci repo shell: powershell From 7761d20866ea98a702432e98c1eccdb541f89669 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 16:30:29 +0200 Subject: [PATCH 35/79] refresh environment by importing module first Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index dc379f7..d541317 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -36,26 +36,11 @@ jobs: run: choco install nodejs -y shell: powershell - - name: Add VSCode and Node.js Manually to PATH + - name: Import Chocolatey Profile and Refresh Environment shell: powershell run: | - $nodePath = 'C:\Program Files\nodejs' - if (-Not (Test-Path $nodePath)) { - Write-Error "Node.js installation path not found at: $nodePath" - exit 1 - } - $env:PATH += ";$nodePath" - - $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' - if (-Not (Test-Path $vscodePath)) { - Write-Error "VSCode installation path not found at: $vscodePath" - exit 1 - } - $env:PATH += ";$vscodePath" - - # Set the updated PATH variable at Machine level - [System.Environment]::SetEnvironmentVariable('PATH', $env:PATH, [System.EnvironmentVariableTarget]::Machine) - echo $env:PATH + Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" + refreshenv - name: Check Env PATH variable shell: powershell From 841047438381eeb3be6e25063705805b817b30a7 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 17:37:35 +0200 Subject: [PATCH 36/79] static paths for vscode, nodejs, and npm Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 45 ++++++++++++++++-------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index d541317..63a28b6 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -36,27 +36,44 @@ jobs: run: choco install nodejs -y shell: powershell - - name: Import Chocolatey Profile and Refresh Environment + - name: Define and Export Node.js and VSCode Paths shell: powershell run: | - Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" - refreshenv + # Define local variables for paths + $nodePath = 'C:\Program Files\nodejs' + $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' + + # Check Node.js Path + if (-Not (Test-Path $nodePath)) { + Write-Error "Node.js installation path not found at: $nodePath" + exit 1 + } + # Check VSCode Path + if (-Not (Test-Path $vscodePath)) { + Write-Error "VSCode installation path not found at: $vscodePath" + exit 1 + } + + # Export the paths so they can be used in subsequent steps + "NODE_PATH=$nodePath" | Out-File -FilePath $env:GITHUB_ENV -Append + "VSCODE_PATH=$vscodePath" | Out-File -FilePath $env:GITHUB_ENV -Append - - name: Check Env PATH variable - shell: powershell - run: echo $env:PATH - -# - name: Verify Installation -# run: | -# & "C:\Program Files\Microsoft VS Code\bin\code" --version -# & "C:\Program Files\nodejs\node.exe" --version +# - name: Check Env PATH variable # shell: powershell +# run: echo $env:PATH + + - name: Verify Installation + run: | + & "C:\Program Files\Microsoft VS Code\bin\code" --version + & "C:\Program Files\nodejs\node.exe" --version + shell: powershell - name: Verify VSCode and Node.js Installation shell: powershell run: | - code --version - node --version + # Use the exported paths + & "$env:VSCODE_PATH\code.exe" --version + & "$env:NODE_PATH\node.exe" --version - name: Clone kai-ci repo shell: powershell @@ -69,7 +86,7 @@ jobs: - name: Install npm dependencies shell: powershell run: | - npm install . + & "$env:NODE_PATH\npm.cmd" install . - name: Run tests shell: powershell From 40d2257f29ad766a07585d5d5cdccd29271a6c88 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 17:44:59 +0200 Subject: [PATCH 37/79] set ENV PATH VAR Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 63a28b6..223bdfc 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -57,23 +57,29 @@ jobs: # Export the paths so they can be used in subsequent steps "NODE_PATH=$nodePath" | Out-File -FilePath $env:GITHUB_ENV -Append "VSCODE_PATH=$vscodePath" | Out-File -FilePath $env:GITHUB_ENV -Append + + # Also update PATH so that Node.js, npm, npx, and VSCode can be called directly + $newPath = "$env:PATH;$nodePath;$vscodePath" + [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) + # Persist the updated PATH to make it available for subsequent steps + "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append # - name: Check Env PATH variable # shell: powershell # run: echo $env:PATH - - name: Verify Installation - run: | - & "C:\Program Files\Microsoft VS Code\bin\code" --version - & "C:\Program Files\nodejs\node.exe" --version - shell: powershell +# - name: Verify VSCode and Node.js Installation +# shell: powershell +# run: | +# # Use the exported paths +# & "$env:VSCODE_PATH\code.exe" --version +# & "$env:NODE_PATH\node.exe" --version - name: Verify VSCode and Node.js Installation shell: powershell run: | - # Use the exported paths - & "$env:VSCODE_PATH\code.exe" --version - & "$env:NODE_PATH\node.exe" --version + code --version + node --version - name: Clone kai-ci repo shell: powershell From 51df9352024cc41686786e1924c3078399cf61c8 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 17:56:39 +0200 Subject: [PATCH 38/79] remove unwanted code Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 35 ++++-------------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 223bdfc..096e559 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -36,45 +36,20 @@ jobs: run: choco install nodejs -y shell: powershell - - name: Define and Export Node.js and VSCode Paths + - name: Define Node.js and VSCode Paths shell: powershell run: | - # Define local variables for paths + $nodePath = 'C:\Program Files\nodejs' $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' - # Check Node.js Path - if (-Not (Test-Path $nodePath)) { - Write-Error "Node.js installation path not found at: $nodePath" - exit 1 - } - # Check VSCode Path - if (-Not (Test-Path $vscodePath)) { - Write-Error "VSCode installation path not found at: $vscodePath" - exit 1 - } - - # Export the paths so they can be used in subsequent steps - "NODE_PATH=$nodePath" | Out-File -FilePath $env:GITHUB_ENV -Append - "VSCODE_PATH=$vscodePath" | Out-File -FilePath $env:GITHUB_ENV -Append - - # Also update PATH so that Node.js, npm, npx, and VSCode can be called directly + # Update PATH so that Node.js, npm, npx, and VSCode can be called directly $newPath = "$env:PATH;$nodePath;$vscodePath" [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) + # Persist the updated PATH to make it available for subsequent steps "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append -# - name: Check Env PATH variable -# shell: powershell -# run: echo $env:PATH - -# - name: Verify VSCode and Node.js Installation -# shell: powershell -# run: | -# # Use the exported paths -# & "$env:VSCODE_PATH\code.exe" --version -# & "$env:NODE_PATH\node.exe" --version - - name: Verify VSCode and Node.js Installation shell: powershell run: | @@ -92,7 +67,7 @@ jobs: - name: Install npm dependencies shell: powershell run: | - & "$env:NODE_PATH\npm.cmd" install . + npm install . - name: Run tests shell: powershell From ce65b911d7ed315b6647dc753f7da22b857f561e Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 18:21:02 +0200 Subject: [PATCH 39/79] add "./" before directory name` Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 096e559..4f05c44 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -62,7 +62,7 @@ jobs: mkdir ./kai-ci-temp cd ./kai-ci-temp git clone https://github.com/konveyor/kai-ci.git - cd kai-ci + cd ./kai-ci - name: Install npm dependencies shell: powershell From 82516634600271c5a9b32f42388da682a3c1d1b0 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 18:37:25 +0200 Subject: [PATCH 40/79] add working directory, and copy upload code from linux-nightly-ci Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 4f05c44..5d1f438 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -62,17 +62,35 @@ jobs: mkdir ./kai-ci-temp cd ./kai-ci-temp git clone https://github.com/konveyor/kai-ci.git - cd ./kai-ci - name: Install npm dependencies shell: powershell + working-directory: ./kai-ci-temp/kai-ci run: | npm install . - name: Run tests shell: powershell + working-directory: ./kai-ci-temp/kai-ci run: | - npx playwright test + npx playwright test || true + + - name: Upload screenshots + uses: actions/upload-artifact@v4 + with: + name: vscode-screenshots + path: | + vscode-initialized-screenshot.png + kai-installed-screenshot.png + if: always() + + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 + stop-ec2-instance: needs: [ start-ec2-instance,run-tests ] From f44601dc117482b24fdba9ef670066a8118e6751 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 18:51:23 +0200 Subject: [PATCH 41/79] continue running workflow even if tests fail Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 5d1f438..b7b60b5 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -73,7 +73,11 @@ jobs: shell: powershell working-directory: ./kai-ci-temp/kai-ci run: | - npx playwright test || true + try { + npx playwright test + } catch { + Write-Host "Playwright tests failed, but continuing workflow." # to continue running even if the tests run fail + } - name: Upload screenshots uses: actions/upload-artifact@v4 From 6c75f68f0dbbe1c1471dfbe6e8e62751cfdc85c9 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 19:07:25 +0200 Subject: [PATCH 42/79] close all vscode running instances Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index b7b60b5..70d3c1b 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -55,6 +55,11 @@ jobs: run: | code --version node --version + - name: Close All VSCode Instances + shell: powershell + run: | + # Close all running instances of VSCode + Get-Process -Name "Code" -ErrorAction SilentlyContinue | ForEach-Object { $_.CloseMainWindow() } | Out-Null - name: Clone kai-ci repo shell: powershell From a23ebf9cf37440c3b0138bb76074fa3633ab1335 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 21:44:53 +0200 Subject: [PATCH 43/79] change `npm install` to `npm ci`, and copy the .env.example to .env Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 70d3c1b..f2ec652 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -72,7 +72,11 @@ jobs: shell: powershell working-directory: ./kai-ci-temp/kai-ci run: | - npm install . + npm ci + + - name: Copy .env.example to .env + shell: powershell + run: Copy-Item -Path .env.example -Destination .env - name: Run tests shell: powershell From 7458a80089ee4a4f8a58fe901dd5de3db315afd4 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 21:56:40 +0200 Subject: [PATCH 44/79] re-added npm install before npm ci Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index f2ec652..0e0c337 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -72,6 +72,7 @@ jobs: shell: powershell working-directory: ./kai-ci-temp/kai-ci run: | + npm install . npm ci - name: Copy .env.example to .env From c1ecf2a75b33cfd6a17f69a7e5a910ebf9d1df29 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 22:09:06 +0200 Subject: [PATCH 45/79] Add working directory before copying .env.example Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 0e0c337..63f9df8 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -77,6 +77,7 @@ jobs: - name: Copy .env.example to .env shell: powershell + working-directory: ./kai-ci-temp/kai-ci run: Copy-Item -Path .env.example -Destination .env - name: Run tests From 3135458f51bb236b1204b2ab50d91c26e1fb2b60 Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 22:42:58 +0200 Subject: [PATCH 46/79] update executable path to match for windows Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 63f9df8..e6f7332 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -75,10 +75,12 @@ jobs: npm install . npm ci - - name: Copy .env.example to .env + - name: Copy .env.example to .env and update executable path shell: powershell working-directory: ./kai-ci-temp/kai-ci - run: Copy-Item -Path .env.example -Destination .env + run: | + Copy-Item -Path .env.example -Destination .env + (Get-Content .env) -replace "VSCODE_EXECUTABLE_PATH=.*", "VSCODE_EXECUTABLE_PATH='C:/Users/$env:USERNAME/AppData/Local/Programs/Microsoft VS Code/Code.exe'" | Set-Content .env - name: Run tests shell: powershell From 7e9076ff537c340c9f91bebecd1390ba6ae75cfd Mon Sep 17 00:00:00 2001 From: midays Date: Mon, 25 Nov 2024 23:03:39 +0200 Subject: [PATCH 47/79] Change executable path for vscode to match `Version 1.19.2` changes Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index e6f7332..6d25392 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -55,6 +55,7 @@ jobs: run: | code --version node --version + - name: Close All VSCode Instances shell: powershell run: | @@ -80,7 +81,7 @@ jobs: working-directory: ./kai-ci-temp/kai-ci run: | Copy-Item -Path .env.example -Destination .env - (Get-Content .env) -replace "VSCODE_EXECUTABLE_PATH=.*", "VSCODE_EXECUTABLE_PATH='C:/Users/$env:USERNAME/AppData/Local/Programs/Microsoft VS Code/Code.exe'" | Set-Content .env + (Get-Content .env) -replace "VSCODE_EXECUTABLE_PATH=.*", "VSCODE_EXECUTABLE_PATH='C:/Program Files/Microsoft VS Code/bin/Code.exe'" | Set-Content .env - name: Run tests shell: powershell From b4d082cc68c589d5259a8948212d113a80460e83 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 00:25:12 +0200 Subject: [PATCH 48/79] remove `/bin` from executable directory Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 6d25392..cd571ec 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -81,7 +81,7 @@ jobs: working-directory: ./kai-ci-temp/kai-ci run: | Copy-Item -Path .env.example -Destination .env - (Get-Content .env) -replace "VSCODE_EXECUTABLE_PATH=.*", "VSCODE_EXECUTABLE_PATH='C:/Program Files/Microsoft VS Code/bin/Code.exe'" | Set-Content .env + (Get-Content .env) -replace "VSCODE_EXECUTABLE_PATH=.*", "VSCODE_EXECUTABLE_PATH='C:/Program Files/Microsoft VS Code/Code.exe'" | Set-Content .env - name: Run tests shell: powershell @@ -109,6 +109,11 @@ jobs: path: playwright-report/ retention-days: 30 + - name: Clean Up Temporary Directory + shell: powershell + run: | + Remove-Item -Recurse -Force ./kai-ci-temp + stop-ec2-instance: needs: [ start-ec2-instance,run-tests ] From fb2abf2d2bca91a2a819d37e05cbad03ee76af33 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 00:40:19 +0200 Subject: [PATCH 49/79] updated the cleanup repo to work for windows Signed-off-by: midays --- e2e/utilities/utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/e2e/utilities/utils.ts b/e2e/utilities/utils.ts index 5a0b940..7b5e579 100644 --- a/e2e/utilities/utils.ts +++ b/e2e/utilities/utils.ts @@ -32,7 +32,13 @@ export function getKAIPluginName(): string { export async function cleanupRepo() { if (fs.existsSync(repoDir)) { try { - await execPromise(`rm -rf "${repoDir}"`); + if (getOSInfo() == 'windows') { + await execPromise( + `powershell.exe Remove-Item -Recurse -Force "${repoDir}"` + ); + } else { + await execPromise(`rm -rf "${repoDir}"`); + } } catch (error) { console.error('Error while cleaning up cloned repository:', error); } From 3c6254cb3b38d4ded0426846b4557fa18ab85b3a Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 00:59:56 +0200 Subject: [PATCH 50/79] remove change Signed-off-by: midays --- e2e/utilities/utils.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/e2e/utilities/utils.ts b/e2e/utilities/utils.ts index 7b5e579..5a0b940 100644 --- a/e2e/utilities/utils.ts +++ b/e2e/utilities/utils.ts @@ -32,13 +32,7 @@ export function getKAIPluginName(): string { export async function cleanupRepo() { if (fs.existsSync(repoDir)) { try { - if (getOSInfo() == 'windows') { - await execPromise( - `powershell.exe Remove-Item -Recurse -Force "${repoDir}"` - ); - } else { - await execPromise(`rm -rf "${repoDir}"`); - } + await execPromise(`rm -rf "${repoDir}"`); } catch (error) { console.error('Error while cleaning up cloned repository:', error); } From 87cd4f229bbc22a5617a15e744759fdc6d187f17 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 03:17:20 +0200 Subject: [PATCH 51/79] added if: always() Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index cd571ec..217f6de 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -113,6 +113,7 @@ jobs: shell: powershell run: | Remove-Item -Recurse -Force ./kai-ci-temp + if: always() stop-ec2-instance: From 5b45f7a7c2da06996a5e418a60bd7eee09e89e62 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 06:23:24 +0200 Subject: [PATCH 52/79] Change step name Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 217f6de..202a7c6 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -109,7 +109,7 @@ jobs: path: playwright-report/ retention-days: 30 - - name: Clean Up Temporary Directory + - name: Clean Up Kai Temp Directory shell: powershell run: | Remove-Item -Recurse -Force ./kai-ci-temp From 8ee121fc13a841c665ab0d15c48496a9020c3619 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 07:20:59 +0200 Subject: [PATCH 53/79] use ami-01fa2492704e48175, and comment installation blocks Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 58 ++++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 202a7c6..62d011b 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -6,7 +6,7 @@ jobs: start-ec2-instance: uses: ./.github/workflows/provision-runner.yml with: - ec2-image-id: ami-0b7d4973163feb944 + ec2-image-id: ami-01fa2492704e48175 ec2-instance-type: t2.micro security-group-id: sg-0a3e6b53e86d0e69d subnet-id: subnet-06113672589e7e836 @@ -21,34 +21,34 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: - - name: Install Chocolatey - run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - shell: powershell - - - name: Install VSCode - run: choco install vscode -y - shell: powershell - - - name: Install Node.js - run: choco install nodejs -y - shell: powershell - - - name: Define Node.js and VSCode Paths - shell: powershell - run: | - - $nodePath = 'C:\Program Files\nodejs' - $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' - - # Update PATH so that Node.js, npm, npx, and VSCode can be called directly - $newPath = "$env:PATH;$nodePath;$vscodePath" - [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) - - # Persist the updated PATH to make it available for subsequent steps - "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append +# - name: Install Chocolatey +# run: | +# Set-ExecutionPolicy Bypass -Scope Process -Force; +# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; +# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +# shell: powershell +# +# - name: Install VSCode +# run: choco install vscode -y +# shell: powershell +# +# - name: Install Node.js +# run: choco install nodejs -y +# shell: powershell +# +# - name: Define Node.js and VSCode Paths +# shell: powershell +# run: | +# +# $nodePath = 'C:\Program Files\nodejs' +# $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' +# +# # Update PATH so that Node.js, npm, npx, and VSCode can be called directly +# $newPath = "$env:PATH;$nodePath;$vscodePath" +# [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) +# +# # Persist the updated PATH to make it available for subsequent steps +# "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Verify VSCode and Node.js Installation shell: powershell From fe708311946c9ca48c6b95c5bdb2fc136a0c8d2f Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 12:53:02 +0200 Subject: [PATCH 54/79] un-comment the installation code blocks Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 56 ++++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 62d011b..ac92b6c 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,34 +21,34 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: -# - name: Install Chocolatey -# run: | -# Set-ExecutionPolicy Bypass -Scope Process -Force; -# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; -# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) -# shell: powershell -# -# - name: Install VSCode -# run: choco install vscode -y -# shell: powershell -# -# - name: Install Node.js -# run: choco install nodejs -y -# shell: powershell -# -# - name: Define Node.js and VSCode Paths -# shell: powershell -# run: | -# -# $nodePath = 'C:\Program Files\nodejs' -# $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' -# -# # Update PATH so that Node.js, npm, npx, and VSCode can be called directly -# $newPath = "$env:PATH;$nodePath;$vscodePath" -# [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) -# -# # Persist the updated PATH to make it available for subsequent steps -# "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append + - name: Install Chocolatey + run: | + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + shell: powershell + + - name: Install VSCode + run: choco install vscode -y + shell: powershell + + - name: Install Node.js + run: choco install nodejs -y + shell: powershell + + - name: Define Node.js and VSCode Paths + shell: powershell + run: | + + $nodePath = 'C:\Program Files\nodejs' + $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' + + # Update PATH so that Node.js, npm, npx, and VSCode can be called directly + $newPath = "$env:PATH;$nodePath;$vscodePath" + [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) + + # Persist the updated PATH to make it available for subsequent steps + "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Verify VSCode and Node.js Installation shell: powershell From 00673cb037a553609b431299772380e65d9c6895 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 15:09:02 +0200 Subject: [PATCH 55/79] try to run script as non-admin user without the installation steps Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 64 ++++++++++++++---------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index ac92b6c..e72bca6 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -11,6 +11,13 @@ jobs: security-group-id: sg-0a3e6b53e86d0e69d subnet-id: subnet-06113672589e7e836 ec2-os-type: windows + user-data: | + + # Enable nonadmin user, set it as the default login, and set its password + net user nonadmin /active:yes + net user nonadmin ${{ secrets.NONADMIN_PASSWORD }} + New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force + secrets: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -21,34 +28,39 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: - - name: Install Chocolatey - run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - shell: powershell - - - name: Install VSCode - run: choco install vscode -y - shell: powershell - - - name: Install Node.js - run: choco install nodejs -y - shell: powershell - - - name: Define Node.js and VSCode Paths +# - name: Install Chocolatey +# run: | +# Set-ExecutionPolicy Bypass -Scope Process -Force; +# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; +# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +# shell: powershell +# +# - name: Install VSCode +# run: choco install vscode -y +# shell: powershell +# +# - name: Install Node.js +# run: choco install nodejs -y +# shell: powershell +# +# - name: Define Node.js and VSCode Paths +# shell: powershell +# run: | +# +# $nodePath = 'C:\Program Files\nodejs' +# $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' +# +# # Update PATH so that Node.js, npm, npx, and VSCode can be called directly +# $newPath = "$env:PATH;$nodePath;$vscodePath" +# [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) +# +# # Persist the updated PATH to make it available for subsequent steps +# "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append + + - name: Print PATH Environment Variable shell: powershell run: | - - $nodePath = 'C:\Program Files\nodejs' - $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' - - # Update PATH so that Node.js, npm, npx, and VSCode can be called directly - $newPath = "$env:PATH;$nodePath;$vscodePath" - [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) - - # Persist the updated PATH to make it available for subsequent steps - "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append + Write-Output "Updated PATH: $env:PATH" - name: Verify VSCode and Node.js Installation shell: powershell From f93f38e986dd5ed116754cef3afa737e288ed90b Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 15:26:07 +0200 Subject: [PATCH 56/79] try with static password Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index e72bca6..273246f 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -15,7 +15,7 @@ jobs: # Enable nonadmin user, set it as the default login, and set its password net user nonadmin /active:yes - net user nonadmin ${{ secrets.NONADMIN_PASSWORD }} + net user nonadmin Dog8code New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force secrets: From 3899d0f702b5f008367c6b7dcc231d596bef1b07 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 15:28:31 +0200 Subject: [PATCH 57/79] try with configure-instance block Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 273246f..2c3907e 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -11,17 +11,27 @@ jobs: security-group-id: sg-0a3e6b53e86d0e69d subnet-id: subnet-06113672589e7e836 ec2-os-type: windows - user-data: | - - # Enable nonadmin user, set it as the default login, and set its password - net user nonadmin /active:yes - net user nonadmin Dog8code - New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force - secrets: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} + configure-instance: + needs: start-ec2-instance + runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} + env: + NONADMIN_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} + steps: + - name: Set nonadmin user password and configure auto-login + shell: powershell + run: | + # Enable nonadmin user and set password + net user nonadmin /active:yes + net user nonadmin $env:NONADMIN_PASSWORD + + # Set nonadmin as default login and enable auto login + New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force + New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "AutoAdminLogon" -Value "1" -Force + run-tests: needs: start-ec2-instance From 9209982583d9acae8a07d56b50d17646ebf9c9a0 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 15:28:43 +0200 Subject: [PATCH 58/79] Revert "try with configure-instance block" This reverts commit 3899d0f702b5f008367c6b7dcc231d596bef1b07. --- .github/workflows/windows-nightly-ci.yml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 2c3907e..273246f 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -11,27 +11,17 @@ jobs: security-group-id: sg-0a3e6b53e86d0e69d subnet-id: subnet-06113672589e7e836 ec2-os-type: windows + user-data: | + + # Enable nonadmin user, set it as the default login, and set its password + net user nonadmin /active:yes + net user nonadmin Dog8code + New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force + secrets: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} - configure-instance: - needs: start-ec2-instance - runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} - env: - NONADMIN_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} - steps: - - name: Set nonadmin user password and configure auto-login - shell: powershell - run: | - # Enable nonadmin user and set password - net user nonadmin /active:yes - net user nonadmin $env:NONADMIN_PASSWORD - - # Set nonadmin as default login and enable auto login - New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force - New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "AutoAdminLogon" -Value "1" -Force - run-tests: needs: start-ec2-instance From 6322a75711a0ef403ddce46862efb4e9f1891ab5 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 15:29:21 +0200 Subject: [PATCH 59/79] try with configure-instance block Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 273246f..2c3907e 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -11,17 +11,27 @@ jobs: security-group-id: sg-0a3e6b53e86d0e69d subnet-id: subnet-06113672589e7e836 ec2-os-type: windows - user-data: | - - # Enable nonadmin user, set it as the default login, and set its password - net user nonadmin /active:yes - net user nonadmin Dog8code - New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force - secrets: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} + configure-instance: + needs: start-ec2-instance + runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} + env: + NONADMIN_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} + steps: + - name: Set nonadmin user password and configure auto-login + shell: powershell + run: | + # Enable nonadmin user and set password + net user nonadmin /active:yes + net user nonadmin $env:NONADMIN_PASSWORD + + # Set nonadmin as default login and enable auto login + New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force + New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "AutoAdminLogon" -Value "1" -Force + run-tests: needs: start-ec2-instance From ded55b215bdafaf05ce4268aa3e31c00b73815e7 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 15:37:59 +0200 Subject: [PATCH 60/79] make the run-tests block require configure-instance to complete Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 2c3907e..7e9e843 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -15,6 +15,7 @@ jobs: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} + configure-instance: needs: start-ec2-instance runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} @@ -34,7 +35,7 @@ jobs: run-tests: - needs: start-ec2-instance + needs: configure-instance runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: From b984ad15e30332c748be1d7cda8d0cd276172e44 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 15:50:21 +0200 Subject: [PATCH 61/79] change needs Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 7e9e843..9bd118b 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -35,7 +35,7 @@ jobs: run-tests: - needs: configure-instance + needs: [start-ec2-instance, configure-instance] runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: From fdec814ee3cd0fc9c605b272a062642818ceef96 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 16:00:09 +0200 Subject: [PATCH 62/79] Update the workflow to include a step that explicitly switches the session to nonadmin before proceeding with other steps Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 42 ++++++++++++++++-------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 9bd118b..c5de000 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -16,28 +16,42 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} - configure-instance: +# configure-instance: +# needs: start-ec2-instance +# runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} +# env: +# NONADMIN_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} +# steps: +# - name: Set nonadmin user password and configure auto-login +# shell: powershell +# run: | +# # Enable nonadmin user and set password +# net user nonadmin /active:yes +# net user nonadmin $env:NONADMIN_PASSWORD +# +# # Set nonadmin as default login and enable auto login +# New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force +# New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "AutoAdminLogon" -Value "1" -Force + + + run-tests: needs: start-ec2-instance runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} env: NONADMIN_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} steps: - - name: Set nonadmin user password and configure auto-login + + - name: Set nonadmin Password shell: powershell run: | - # Enable nonadmin user and set password - net user nonadmin /active:yes - net user nonadmin $env:NONADMIN_PASSWORD + net user nonadmin $env:NONADMIN_PASSWORD - # Set nonadmin as default login and enable auto login - New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force - New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "AutoAdminLogon" -Value "1" -Force - - - run-tests: - needs: [start-ec2-instance, configure-instance] - runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} - steps: + - name: Switch to nonadmin User + shell: powershell + run: | + $password = ConvertTo-SecureString -String $env:NONADMIN_PASSWORD -AsPlainText -Force + $credential = New-Object System.Management.Automation.PSCredential('nonadmin', $password) + Start-Process -FilePath "powershell.exe" -ArgumentList "-NoExit" -Credential $credential # - name: Install Chocolatey # run: | From d915c0cfc741d69654197680d73363ed31279110 Mon Sep 17 00:00:00 2001 From: midays Date: Tue, 26 Nov 2024 16:11:35 +0200 Subject: [PATCH 63/79] revert Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 74 ++++++++++++------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index c5de000..17b7cbf 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -37,50 +37,50 @@ jobs: run-tests: needs: start-ec2-instance runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} - env: - NONADMIN_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} +# env: +# NONADMIN_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} steps: - - name: Set nonadmin Password - shell: powershell +# - name: Set nonadmin Password +# shell: powershell +# run: | +# net user nonadmin $env:NONADMIN_PASSWORD +# +# - name: Switch to nonadmin User +# shell: powershell +# run: | +# $password = ConvertTo-SecureString -String $env:NONADMIN_PASSWORD -AsPlainText -Force +# $credential = New-Object System.Management.Automation.PSCredential('nonadmin', $password) +# Start-Process powershell -ArgumentList "-NoExit -Command `"Set-ExecutionPolicy Bypass -Scope Process; Invoke-Expression -Command .\test_script.ps1`"" -Credential $credential + + - name: Install Chocolatey run: | - net user nonadmin $env:NONADMIN_PASSWORD + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + shell: powershell + + - name: Install VSCode + run: choco install vscode -y + shell: powershell + + - name: Install Node.js + run: choco install nodejs -y + shell: powershell - - name: Switch to nonadmin User + - name: Define Node.js and VSCode Paths shell: powershell run: | - $password = ConvertTo-SecureString -String $env:NONADMIN_PASSWORD -AsPlainText -Force - $credential = New-Object System.Management.Automation.PSCredential('nonadmin', $password) - Start-Process -FilePath "powershell.exe" -ArgumentList "-NoExit" -Credential $credential -# - name: Install Chocolatey -# run: | -# Set-ExecutionPolicy Bypass -Scope Process -Force; -# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; -# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) -# shell: powershell -# -# - name: Install VSCode -# run: choco install vscode -y -# shell: powershell -# -# - name: Install Node.js -# run: choco install nodejs -y -# shell: powershell -# -# - name: Define Node.js and VSCode Paths -# shell: powershell -# run: | -# -# $nodePath = 'C:\Program Files\nodejs' -# $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' -# -# # Update PATH so that Node.js, npm, npx, and VSCode can be called directly -# $newPath = "$env:PATH;$nodePath;$vscodePath" -# [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) -# -# # Persist the updated PATH to make it available for subsequent steps -# "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append + $nodePath = 'C:\Program Files\nodejs' + $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' + + # Update PATH so that Node.js, npm, npx, and VSCode can be called directly + $newPath = "$env:PATH;$nodePath;$vscodePath" + [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) + + # Persist the updated PATH to make it available for subsequent steps + "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Print PATH Environment Variable shell: powershell From 8bf6d534174f2075e6a320a0994c406a64a64e88 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 08:42:29 +0200 Subject: [PATCH 64/79] configure the runner to default to non-admin user when executing in the VM Signed-off-by: midays --- .github/workflows/provision-runner.yml | 33 +++++++++- .github/workflows/windows-nightly-ci.yml | 80 +++++++----------------- 2 files changed, 56 insertions(+), 57 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 70a51d4..e4e4f31 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -78,4 +78,35 @@ jobs: - name: Output EC2 Instance ID run: | echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" - echo "Label : ${{ steps.ec2.outputs.label }}" \ No newline at end of file + echo "Label : ${{ steps.ec2.outputs.label }}" + + configure-ec2: + needs: provision-ec2 + runs-on: ${{ needs.provision-ec2.outputs.label }} + steps: + - name: Set Default Login to Non-Admin User (Windows Specific) + if: ${{ inputs.ec2-os-type == 'windows' }} + shell: powershell + run: | + # Enable nonadmin user and set as default login + net user nonadmin /active:yes + reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d nonadmin /f + reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f + + - name: Configure GitHub Runner Service to Run as Non-Admin User + if: ${{ inputs.ec2-os-type == 'windows' }} + shell: powershell + env: + NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} + run: | + # Stop the GitHub Actions Runner service + Stop-Service actions.runner.* + + # Update the service to use the nonadmin user credentials + $serviceName = Get-Service | Where-Object { $_.Name -like 'actions.runner.*' } | Select-Object -ExpandProperty Name + $username = "nonadmin" + $password = $env:NONADMIN_PASSWORD + sc.exe config $serviceName obj= ".\$username" password= "$password" + + # Start the GitHub Actions Runner service again + Start-Service $serviceName \ No newline at end of file diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 17b7cbf..d456fa1 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -16,71 +16,39 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} -# configure-instance: -# needs: start-ec2-instance -# runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} -# env: -# NONADMIN_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} -# steps: -# - name: Set nonadmin user password and configure auto-login -# shell: powershell -# run: | -# # Enable nonadmin user and set password -# net user nonadmin /active:yes -# net user nonadmin $env:NONADMIN_PASSWORD -# -# # Set nonadmin as default login and enable auto login -# New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "DefaultUserName" -Value "nonadmin" -Force -# New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "AutoAdminLogon" -Value "1" -Force - - run-tests: needs: start-ec2-instance runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} -# env: -# NONADMIN_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} steps: -# - name: Set nonadmin Password -# shell: powershell +# - name: Install Chocolatey # run: | -# net user nonadmin $env:NONADMIN_PASSWORD +# Set-ExecutionPolicy Bypass -Scope Process -Force; +# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; +# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +# shell: powershell # -# - name: Switch to nonadmin User +# - name: Install VSCode +# run: choco install vscode -y +# shell: powershell +# +# - name: Install Node.js +# run: choco install nodejs -y +# shell: powershell +# +# - name: Define Node.js and VSCode Paths # shell: powershell # run: | -# $password = ConvertTo-SecureString -String $env:NONADMIN_PASSWORD -AsPlainText -Force -# $credential = New-Object System.Management.Automation.PSCredential('nonadmin', $password) -# Start-Process powershell -ArgumentList "-NoExit -Command `"Set-ExecutionPolicy Bypass -Scope Process; Invoke-Expression -Command .\test_script.ps1`"" -Credential $credential - - - name: Install Chocolatey - run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - shell: powershell - - - name: Install VSCode - run: choco install vscode -y - shell: powershell - - - name: Install Node.js - run: choco install nodejs -y - shell: powershell - - - name: Define Node.js and VSCode Paths - shell: powershell - run: | - - $nodePath = 'C:\Program Files\nodejs' - $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' - - # Update PATH so that Node.js, npm, npx, and VSCode can be called directly - $newPath = "$env:PATH;$nodePath;$vscodePath" - [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) - - # Persist the updated PATH to make it available for subsequent steps - "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append +# +# $nodePath = 'C:\Program Files\nodejs' +# $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' +# +# # Update PATH so that Node.js, npm, npx, and VSCode can be called directly +# $newPath = "$env:PATH;$nodePath;$vscodePath" +# [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) +# +# # Persist the updated PATH to make it available for subsequent steps +# "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Print PATH Environment Variable shell: powershell From caf18e560d70d53e889a486bcaf62e921f74dec0 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 08:56:38 +0200 Subject: [PATCH 65/79] change approach Signed-off-by: midays --- .github/workflows/provision-runner.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index e4e4f31..bdea2e5 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -100,13 +100,20 @@ jobs: NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} run: | # Stop the GitHub Actions Runner service - Stop-Service actions.runner.* + $serviceName = Get-Service -Name 'actions.runner*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name + + if (-not $serviceName) { + Write-Error "GitHub Actions runner service not found." + exit 1 + } + + # Stop the GitHub Actions Runner service + Stop-Service -Name $serviceName -Force # Update the service to use the nonadmin user credentials - $serviceName = Get-Service | Where-Object { $_.Name -like 'actions.runner.*' } | Select-Object -ExpandProperty Name $username = "nonadmin" $password = $env:NONADMIN_PASSWORD sc.exe config $serviceName obj= ".\$username" password= "$password" # Start the GitHub Actions Runner service again - Start-Service $serviceName \ No newline at end of file + Start-Service -Name $serviceName From 2143757ca7fa30827939d6c3302fa050e0885b0f Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 09:17:13 +0200 Subject: [PATCH 66/79] remove non-admin runner configuration for now Signed-off-by: midays --- .github/workflows/provision-runner.yml | 74 +++++++++++++------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index bdea2e5..973819e 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -80,40 +80,40 @@ jobs: echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" echo "Label : ${{ steps.ec2.outputs.label }}" - configure-ec2: - needs: provision-ec2 - runs-on: ${{ needs.provision-ec2.outputs.label }} - steps: - - name: Set Default Login to Non-Admin User (Windows Specific) - if: ${{ inputs.ec2-os-type == 'windows' }} - shell: powershell - run: | - # Enable nonadmin user and set as default login - net user nonadmin /active:yes - reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d nonadmin /f - reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f - - - name: Configure GitHub Runner Service to Run as Non-Admin User - if: ${{ inputs.ec2-os-type == 'windows' }} - shell: powershell - env: - NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} - run: | - # Stop the GitHub Actions Runner service - $serviceName = Get-Service -Name 'actions.runner*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name - - if (-not $serviceName) { - Write-Error "GitHub Actions runner service not found." - exit 1 - } - - # Stop the GitHub Actions Runner service - Stop-Service -Name $serviceName -Force - - # Update the service to use the nonadmin user credentials - $username = "nonadmin" - $password = $env:NONADMIN_PASSWORD - sc.exe config $serviceName obj= ".\$username" password= "$password" - - # Start the GitHub Actions Runner service again - Start-Service -Name $serviceName +# configure-ec2: +# needs: provision-ec2 +# runs-on: ${{ needs.provision-ec2.outputs.label }} +# steps: +# - name: Set Default Login to Non-Admin User (Windows Specific) +# if: ${{ inputs.ec2-os-type == 'windows' }} +# shell: powershell +# run: | +# # Enable nonadmin user and set as default login +# net user nonadmin /active:yes +# reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d nonadmin /f +# reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f +# +# - name: Configure GitHub Runner Service to Run as Non-Admin User +# if: ${{ inputs.ec2-os-type == 'windows' }} +# shell: powershell +# env: +# NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} +# run: | +# # Stop the GitHub Actions Runner service +# $serviceName = Get-Service -Name 'actions.runner*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name +# +# if (-not $serviceName) { +# Write-Error "GitHub Actions runner service not found." +# exit 1 +# } +# +# # Stop the GitHub Actions Runner service +# Stop-Service -Name $serviceName -Force +# +# # Update the service to use the nonadmin user credentials +# $username = "nonadmin" +# $password = $env:NONADMIN_PASSWORD +# sc.exe config $serviceName obj= ".\$username" password= "$password" +# +# # Start the GitHub Actions Runner service again +# Start-Service -Name $serviceName From 1629e05da51a72099ec98526abf07247a4d76765 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 09:35:17 +0200 Subject: [PATCH 67/79] re add installations Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 56 ++++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index d456fa1..22d33b3 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,34 +21,34 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: -# - name: Install Chocolatey -# run: | -# Set-ExecutionPolicy Bypass -Scope Process -Force; -# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; -# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) -# shell: powershell -# -# - name: Install VSCode -# run: choco install vscode -y -# shell: powershell -# -# - name: Install Node.js -# run: choco install nodejs -y -# shell: powershell -# -# - name: Define Node.js and VSCode Paths -# shell: powershell -# run: | -# -# $nodePath = 'C:\Program Files\nodejs' -# $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' -# -# # Update PATH so that Node.js, npm, npx, and VSCode can be called directly -# $newPath = "$env:PATH;$nodePath;$vscodePath" -# [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) -# -# # Persist the updated PATH to make it available for subsequent steps -# "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append + - name: Install Chocolatey + run: | + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + shell: powershell + + - name: Install VSCode + run: choco install vscode -y + shell: powershell + + - name: Install Node.js + run: choco install nodejs -y + shell: powershell + + - name: Define Node.js and VSCode Paths + shell: powershell + run: | + + $nodePath = 'C:\Program Files\nodejs' + $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' + + # Update PATH so that Node.js, npm, npx, and VSCode can be called directly + $newPath = "$env:PATH;$nodePath;$vscodePath" + [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) + + # Persist the updated PATH to make it available for subsequent steps + "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Print PATH Environment Variable shell: powershell From 7cfe6043d2343e73aaa0df846e473e376c672168 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 10:54:23 +0200 Subject: [PATCH 68/79] Change working directory to avoid permission error Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 22d33b3..e90b36f 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -67,30 +67,35 @@ jobs: # Close all running instances of VSCode Get-Process -Name "Code" -ErrorAction SilentlyContinue | ForEach-Object { $_.CloseMainWindow() } | Out-Null + - name: Create Temporary Work Directory + shell: powershell + run: | + # Creating a directory outside System32 for better permissions + New-Item -Path "C:\actions-runner\work" -ItemType Directory -Force + - name: Clone kai-ci repo shell: powershell run: | - mkdir ./kai-ci-temp - cd ./kai-ci-temp + cd C:\actions-runner\work git clone https://github.com/konveyor/kai-ci.git - name: Install npm dependencies shell: powershell - working-directory: ./kai-ci-temp/kai-ci + working-directory: C:\actions-runner\work\kai-ci run: | npm install . npm ci - name: Copy .env.example to .env and update executable path shell: powershell - working-directory: ./kai-ci-temp/kai-ci + working-directory: C:\actions-runner\work\kai-ci run: | Copy-Item -Path .env.example -Destination .env (Get-Content .env) -replace "VSCODE_EXECUTABLE_PATH=.*", "VSCODE_EXECUTABLE_PATH='C:/Program Files/Microsoft VS Code/Code.exe'" | Set-Content .env - name: Run tests shell: powershell - working-directory: ./kai-ci-temp/kai-ci + working-directory: C:\actions-runner\work\kai-ci run: | try { npx playwright test @@ -117,7 +122,7 @@ jobs: - name: Clean Up Kai Temp Directory shell: powershell run: | - Remove-Item -Recurse -Force ./kai-ci-temp + Remove-Item -Recurse -Force C:\actions-runner\work\kai-ci if: always() @@ -131,4 +136,4 @@ jobs: secrets: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} \ No newline at end of file + github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} From a26aa59320ace7053a74c0a4b5bb8238d8b38c9d Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 13:40:27 +0200 Subject: [PATCH 69/79] try to update test results Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index e90b36f..aa13b13 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -115,8 +115,8 @@ jobs: - uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: - name: playwright-report - path: playwright-report/ + name: test-results + path: test-results/ retention-days: 30 - name: Clean Up Kai Temp Directory From bd45bbdd84f93e0ba79a90aa9de8849bbaeec126 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 15:09:14 +0200 Subject: [PATCH 70/79] don't remove instance after starting the job Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index aa13b13..398548a 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -126,14 +126,14 @@ jobs: if: always() - stop-ec2-instance: - needs: [ start-ec2-instance,run-tests ] - if: always() - uses: ./.github/workflows/remove-runner.yml - with: - ec2-instance-id: ${{ needs.start-ec2-instance.outputs.ec2-instance-id }} - ec2-runner-label: ${{ needs.start-ec2-instance.outputs.instance_label }} - secrets: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} +# stop-ec2-instance: +# needs: [ start-ec2-instance,run-tests ] +# if: always() +# uses: ./.github/workflows/remove-runner.yml +# with: +# ec2-instance-id: ${{ needs.start-ec2-instance.outputs.ec2-instance-id }} +# ec2-runner-label: ${{ needs.start-ec2-instance.outputs.instance_label }} +# secrets: +# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} +# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} +# github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} From bb9069b1191e5ffb5a54fb7b880a71b17879732b Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 16:14:04 +0200 Subject: [PATCH 71/79] run again with new password secret Signed-off-by: midays --- .github/workflows/provision-runner.yml | 74 +++++++++++++------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 973819e..ac711c9 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -80,40 +80,40 @@ jobs: echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" echo "Label : ${{ steps.ec2.outputs.label }}" -# configure-ec2: -# needs: provision-ec2 -# runs-on: ${{ needs.provision-ec2.outputs.label }} -# steps: -# - name: Set Default Login to Non-Admin User (Windows Specific) -# if: ${{ inputs.ec2-os-type == 'windows' }} -# shell: powershell -# run: | -# # Enable nonadmin user and set as default login -# net user nonadmin /active:yes -# reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d nonadmin /f -# reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f -# -# - name: Configure GitHub Runner Service to Run as Non-Admin User -# if: ${{ inputs.ec2-os-type == 'windows' }} -# shell: powershell -# env: -# NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} -# run: | -# # Stop the GitHub Actions Runner service -# $serviceName = Get-Service -Name 'actions.runner*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name -# -# if (-not $serviceName) { -# Write-Error "GitHub Actions runner service not found." -# exit 1 -# } -# -# # Stop the GitHub Actions Runner service -# Stop-Service -Name $serviceName -Force -# -# # Update the service to use the nonadmin user credentials -# $username = "nonadmin" -# $password = $env:NONADMIN_PASSWORD -# sc.exe config $serviceName obj= ".\$username" password= "$password" -# -# # Start the GitHub Actions Runner service again -# Start-Service -Name $serviceName + configure-ec2: + needs: provision-ec2 + runs-on: ${{ needs.provision-ec2.outputs.label }} + steps: + - name: Set Default Login to Non-Admin User (Windows Specific) + if: ${{ inputs.ec2-os-type == 'windows' }} + shell: powershell + run: | + # Enable nonadmin user and set as default login + net user nonadmin /active:yes + reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d nonadmin /f + reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f + + - name: Configure GitHub Runner Service to Run as Non-Admin User + if: ${{ inputs.ec2-os-type == 'windows' }} + shell: powershell + env: + NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} + run: | + # Stop the GitHub Actions Runner service + $serviceName = Get-Service -Name 'actions.runner*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name + + if (-not $serviceName) { + Write-Error "GitHub Actions runner service not found." + exit 1 + } + + # Stop the GitHub Actions Runner service + Stop-Service -Name $serviceName -Force + + # Update the service to use the nonadmin user credentials + $username = "nonadmin" + $password = $env:NONADMIN_PASSWORD + sc.exe config $serviceName obj= ".\$username" password= "$password" + + # Start the GitHub Actions Runner service again + Start-Service -Name $serviceName From e1cc52dfb10b7ab909175ad0de4cbb348c8fe3ba Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 16:15:04 +0200 Subject: [PATCH 72/79] no installation Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 56 ++++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 398548a..9b15243 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,34 +21,34 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: - - name: Install Chocolatey - run: | - Set-ExecutionPolicy Bypass -Scope Process -Force; - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - shell: powershell - - - name: Install VSCode - run: choco install vscode -y - shell: powershell - - - name: Install Node.js - run: choco install nodejs -y - shell: powershell - - - name: Define Node.js and VSCode Paths - shell: powershell - run: | - - $nodePath = 'C:\Program Files\nodejs' - $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' - - # Update PATH so that Node.js, npm, npx, and VSCode can be called directly - $newPath = "$env:PATH;$nodePath;$vscodePath" - [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) - - # Persist the updated PATH to make it available for subsequent steps - "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append +# - name: Install Chocolatey +# run: | +# Set-ExecutionPolicy Bypass -Scope Process -Force; +# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; +# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +# shell: powershell +# +# - name: Install VSCode +# run: choco install vscode -y +# shell: powershell +# +# - name: Install Node.js +# run: choco install nodejs -y +# shell: powershell +# +# - name: Define Node.js and VSCode Paths +# shell: powershell +# run: | +# +# $nodePath = 'C:\Program Files\nodejs' +# $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' +# +# # Update PATH so that Node.js, npm, npx, and VSCode can be called directly +# $newPath = "$env:PATH;$nodePath;$vscodePath" +# [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) +# +# # Persist the updated PATH to make it available for subsequent steps +# "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Print PATH Environment Variable shell: powershell From 48f56f3ac1d7d96013fe1a42e0038ca5befe8310 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 16:53:49 +0200 Subject: [PATCH 73/79] remove setting default admin, print the current user, check if vscode, nodejs installed Signed-off-by: midays --- .github/workflows/provision-runner.yml | 74 ++++++++++++------------ .github/workflows/windows-nightly-ci.yml | 37 ++++++++++++ 2 files changed, 74 insertions(+), 37 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index ac711c9..973819e 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -80,40 +80,40 @@ jobs: echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" echo "Label : ${{ steps.ec2.outputs.label }}" - configure-ec2: - needs: provision-ec2 - runs-on: ${{ needs.provision-ec2.outputs.label }} - steps: - - name: Set Default Login to Non-Admin User (Windows Specific) - if: ${{ inputs.ec2-os-type == 'windows' }} - shell: powershell - run: | - # Enable nonadmin user and set as default login - net user nonadmin /active:yes - reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d nonadmin /f - reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f - - - name: Configure GitHub Runner Service to Run as Non-Admin User - if: ${{ inputs.ec2-os-type == 'windows' }} - shell: powershell - env: - NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} - run: | - # Stop the GitHub Actions Runner service - $serviceName = Get-Service -Name 'actions.runner*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name - - if (-not $serviceName) { - Write-Error "GitHub Actions runner service not found." - exit 1 - } - - # Stop the GitHub Actions Runner service - Stop-Service -Name $serviceName -Force - - # Update the service to use the nonadmin user credentials - $username = "nonadmin" - $password = $env:NONADMIN_PASSWORD - sc.exe config $serviceName obj= ".\$username" password= "$password" - - # Start the GitHub Actions Runner service again - Start-Service -Name $serviceName +# configure-ec2: +# needs: provision-ec2 +# runs-on: ${{ needs.provision-ec2.outputs.label }} +# steps: +# - name: Set Default Login to Non-Admin User (Windows Specific) +# if: ${{ inputs.ec2-os-type == 'windows' }} +# shell: powershell +# run: | +# # Enable nonadmin user and set as default login +# net user nonadmin /active:yes +# reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d nonadmin /f +# reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f +# +# - name: Configure GitHub Runner Service to Run as Non-Admin User +# if: ${{ inputs.ec2-os-type == 'windows' }} +# shell: powershell +# env: +# NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} +# run: | +# # Stop the GitHub Actions Runner service +# $serviceName = Get-Service -Name 'actions.runner*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name +# +# if (-not $serviceName) { +# Write-Error "GitHub Actions runner service not found." +# exit 1 +# } +# +# # Stop the GitHub Actions Runner service +# Stop-Service -Name $serviceName -Force +# +# # Update the service to use the nonadmin user credentials +# $username = "nonadmin" +# $password = $env:NONADMIN_PASSWORD +# sc.exe config $serviceName obj= ".\$username" password= "$password" +# +# # Start the GitHub Actions Runner service again +# Start-Service -Name $serviceName diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 9b15243..bf86c8a 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -50,6 +50,43 @@ jobs: # # Persist the updated PATH to make it available for subsequent steps # "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append + - name: Check Visual Studio Code and Node.js Installation Paths + shell: powershell + run: | + # Check if Visual Studio Code is installed and print the installation path + $vscodePaths = @( + 'C:\Program Files\Microsoft VS Code\Code.exe', + 'C:\Users\*\AppData\Local\Programs\Microsoft VS Code\Code.exe' + ) + + $vscodeInstalled = $false + foreach ($path in $vscodePaths) { + $resolvedPaths = Get-ChildItem -Path $path -ErrorAction SilentlyContinue + foreach ($resolvedPath in $resolvedPaths) { + Write-Output "VSCode is installed at: $($resolvedPath.FullName)" + $vscodeInstalled = $true + } + } + + if (-not $vscodeInstalled) { + Write-Output "VSCode is not installed." + } + + # Check if Node.js is installed and print the installation path + try { + $nodejsPath = (& where.exe node) + Write-Output "Node.js is installed at: $nodejsPath" + } catch { + Write-Output "Node.js is not installed." + } + + - name: Print Current Logged-In User + shell: powershell + run: | + # Print the current logged-in user + Write-Output "Current User: $(whoami)" + Write-Output "Environment User: $env:USERNAME" + - name: Print PATH Environment Variable shell: powershell run: | From 0495c54cfea2a90333ebe0bfd79f3a771dcb5bf4 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 18:22:21 +0200 Subject: [PATCH 74/79] use existing VSCode.exe Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 99 ++++++++++++------------ 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index bf86c8a..d9f230d 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -21,64 +21,65 @@ jobs: runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: -# - name: Install Chocolatey -# run: | -# Set-ExecutionPolicy Bypass -Scope Process -Force; -# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; -# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) -# shell: powershell -# + - name: Install Chocolatey + run: | + Set-ExecutionPolicy Bypass -Scope Process -Force; + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + shell: powershell + # - name: Install VSCode # run: choco install vscode -y # shell: powershell + + - name: Install Node.js + run: choco install nodejs -y + shell: powershell # -# - name: Install Node.js -# run: choco install nodejs -y -# shell: powershell -# -# - name: Define Node.js and VSCode Paths + - name: Define Node.js and VSCode Paths + shell: powershell + run: | + + $nodePath = 'C:\Program Files\nodejs' + $vscodePath = 'C:/Users/nonadmin/AppData/Local/Programs/Microsoft VS Code/Code.exe' + + # Update PATH so that Node.js, npm, npx, and VSCode can be called directly + $newPath = "$env:PATH;$nodePath;$vscodePath" + [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) + + # Persist the updated PATH to make it available for subsequent steps + "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append + +# - name: Check Visual Studio Code and Node.js Installation Paths # shell: powershell # run: | +# # Check if Visual Studio Code is installed and print the installation path +# $vscodePaths = @( +# 'C:\Program Files\Microsoft VS Code\Code.exe', +# 'C:\Users\*\AppData\Local\Programs\Microsoft VS Code\Code.exe' +# ) # -# $nodePath = 'C:\Program Files\nodejs' -# $vscodePath = 'C:\Program Files\Microsoft VS Code\bin' +# $vscodeInstalled = $false # -# # Update PATH so that Node.js, npm, npx, and VSCode can be called directly -# $newPath = "$env:PATH;$nodePath;$vscodePath" -# [System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Process) +# foreach ($path in $vscodePaths) { +# $resolvedPaths = Get-ChildItem -Path $path -ErrorAction SilentlyContinue +# foreach ($resolvedPath in $resolvedPaths) { +# Write-Output "VSCode is installed at: $($resolvedPath.FullName)" +# $vscodeInstalled = $true +# } +# } # -# # Persist the updated PATH to make it available for subsequent steps -# "PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Append - - - name: Check Visual Studio Code and Node.js Installation Paths - shell: powershell - run: | - # Check if Visual Studio Code is installed and print the installation path - $vscodePaths = @( - 'C:\Program Files\Microsoft VS Code\Code.exe', - 'C:\Users\*\AppData\Local\Programs\Microsoft VS Code\Code.exe' - ) - - $vscodeInstalled = $false - foreach ($path in $vscodePaths) { - $resolvedPaths = Get-ChildItem -Path $path -ErrorAction SilentlyContinue - foreach ($resolvedPath in $resolvedPaths) { - Write-Output "VSCode is installed at: $($resolvedPath.FullName)" - $vscodeInstalled = $true - } - } - - if (-not $vscodeInstalled) { - Write-Output "VSCode is not installed." - } - - # Check if Node.js is installed and print the installation path - try { - $nodejsPath = (& where.exe node) - Write-Output "Node.js is installed at: $nodejsPath" - } catch { - Write-Output "Node.js is not installed." - } +# if (-not $vscodeInstalled) { +# Write-Output "VSCode is not installed." +# } +# +# # Check if Node.js is installed and print the installation path +# try { +# $nodejsPath = (& where.exe node) +# Write-Output "Node.js is installed at: $nodejsPath" +# } catch { +# Write-Output "Node.js is not installed." +# } - name: Print Current Logged-In User shell: powershell From b0d4dd0d339f3d67a0c2f16a9eb6a04472744286 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 19:00:59 +0200 Subject: [PATCH 75/79] try to switch to non-admin Signed-off-by: midays --- .github/workflows/provision-runner.yml | 73 ++++++++++++------------ .github/workflows/windows-nightly-ci.yml | 6 +- 2 files changed, 38 insertions(+), 41 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 973819e..62caa60 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -80,40 +80,39 @@ jobs: echo "EC2 Instance ID: ${{ steps.ec2.outputs.ec2-instance-id }}" echo "Label : ${{ steps.ec2.outputs.label }}" -# configure-ec2: -# needs: provision-ec2 -# runs-on: ${{ needs.provision-ec2.outputs.label }} -# steps: -# - name: Set Default Login to Non-Admin User (Windows Specific) -# if: ${{ inputs.ec2-os-type == 'windows' }} -# shell: powershell -# run: | -# # Enable nonadmin user and set as default login -# net user nonadmin /active:yes -# reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d nonadmin /f -# reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f -# -# - name: Configure GitHub Runner Service to Run as Non-Admin User -# if: ${{ inputs.ec2-os-type == 'windows' }} -# shell: powershell -# env: -# NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} -# run: | -# # Stop the GitHub Actions Runner service -# $serviceName = Get-Service -Name 'actions.runner*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name -# -# if (-not $serviceName) { -# Write-Error "GitHub Actions runner service not found." -# exit 1 -# } -# -# # Stop the GitHub Actions Runner service -# Stop-Service -Name $serviceName -Force -# -# # Update the service to use the nonadmin user credentials -# $username = "nonadmin" -# $password = $env:NONADMIN_PASSWORD -# sc.exe config $serviceName obj= ".\$username" password= "$password" -# -# # Start the GitHub Actions Runner service again -# Start-Service -Name $serviceName + configure-ec2: + needs: provision-ec2 + runs-on: ${{ needs.provision-ec2.outputs.label }} + steps: + - name: Reconfigure Runner Service to Use Non-Admin User + shell: powershell + env: + NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} + run: | + try { + # Stop the GitHub Actions Runner service + Write-Output "Stopping GitHub Actions Runner service..." + $serviceName = Get-Service -Name 'actions.runner*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name + if (-not $serviceName) { + Write-Error "GitHub Actions runner service not found." + exit 1 + } + + Stop-Service -Name $serviceName -Force + Write-Output "Service stopped: $serviceName" + + # Update the service to use the nonadmin user credentials + Write-Output "Reconfiguring the service to use nonadmin user..." + sc.exe config $serviceName obj= ".\nonadmin" password= "$env:NONADMIN_PASSWORD" + Write-Output "Service reconfiguration command executed." + + # Start the GitHub Actions Runner service again + Start-Service -Name $serviceName + Write-Output "Service restarted successfully." + + # Verify service configuration + $updatedService = Get-Service -Name $serviceName | Select-Object Name, StartName + Write-Output "Service details: $($updatedService.Name) - Running as $($updatedService.StartName)" + } catch { + Write-Host "Failed to configure the runner service: $_.Exception.Message" + } diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index d9f230d..2ed25a5 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -81,12 +81,10 @@ jobs: # Write-Output "Node.js is not installed." # } - - name: Print Current Logged-In User + - name: Verify Current User shell: powershell run: | - # Print the current logged-in user - Write-Output "Current User: $(whoami)" - Write-Output "Environment User: $env:USERNAME" + whoami - name: Print PATH Environment Variable shell: powershell From 0b6bb8836470f170679c7f5e56c8dc38a6f4ea08 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 19:14:01 +0200 Subject: [PATCH 76/79] try to debug why user is not being switched Signed-off-by: midays --- .github/workflows/provision-runner.yml | 12 +++++++++--- .github/workflows/windows-nightly-ci.yml | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 62caa60..11dad6f 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -90,14 +90,20 @@ jobs: NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} run: | try { - # Stop the GitHub Actions Runner service - Write-Output "Stopping GitHub Actions Runner service..." - $serviceName = Get-Service -Name 'actions.runner*' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Name + # List all services to debug what services are running + Write-Output "Listing all available services to find the GitHub Actions Runner service..." + Get-Service | Select-Object Name, DisplayName, Status, StartName + + # Attempt to find the GitHub Actions Runner service more reliably + $serviceName = Get-Service | Where-Object { $_.Name -like '*actions.runner*' } | Select-Object -ExpandProperty Name + if (-not $serviceName) { Write-Error "GitHub Actions runner service not found." exit 1 } + # Stop the GitHub Actions Runner service + Write-Output "Stopping GitHub Actions Runner service: $serviceName" Stop-Service -Name $serviceName -Force Write-Output "Service stopped: $serviceName" diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 2ed25a5..73c1829 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -162,14 +162,14 @@ jobs: if: always() -# stop-ec2-instance: -# needs: [ start-ec2-instance,run-tests ] -# if: always() -# uses: ./.github/workflows/remove-runner.yml -# with: -# ec2-instance-id: ${{ needs.start-ec2-instance.outputs.ec2-instance-id }} -# ec2-runner-label: ${{ needs.start-ec2-instance.outputs.instance_label }} -# secrets: -# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} -# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} -# github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} + stop-ec2-instance: + needs: [ start-ec2-instance,run-tests ] + if: always() + uses: ./.github/workflows/remove-runner.yml + with: + ec2-instance-id: ${{ needs.start-ec2-instance.outputs.ec2-instance-id }} + ec2-runner-label: ${{ needs.start-ec2-instance.outputs.instance_label }} + secrets: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} From 384b6c6e060af579b901809b3b1664e410e4c288 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 19:28:04 +0200 Subject: [PATCH 77/79] debug the runner Signed-off-by: midays --- .github/workflows/provision-runner.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 11dad6f..87d4de0 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -90,13 +90,16 @@ jobs: NONADMIN_PASSWORD: ${{ secrets.nonadmin-password }} run: | try { - # List all services to debug what services are running - Write-Output "Listing all available services to find the GitHub Actions Runner service..." + # List all services with detailed information to identify the runner service + Write-Output "Listing all available services to identify the GitHub Actions Runner service..." Get-Service | Select-Object Name, DisplayName, Status, StartName - # Attempt to find the GitHub Actions Runner service more reliably - $serviceName = Get-Service | Where-Object { $_.Name -like '*actions.runner*' } | Select-Object -ExpandProperty Name - + # Attempt to find the GitHub Actions Runner service with a more generalized matching + Write-Output "Attempting to find the GitHub Actions Runner service..." + $serviceName = Get-Service | Where-Object { + $_.DisplayName -like '*GitHub*Runner*' -or $_.Name -like '*actions.runner*' + } | Select-Object -ExpandProperty Name -First 1 + if (-not $serviceName) { Write-Error "GitHub Actions runner service not found." exit 1 From 978de1845a55a8e289e96210660a0d87ace1e444 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 19:44:26 +0200 Subject: [PATCH 78/79] change service debug Signed-off-by: midays --- .github/workflows/provision-runner.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/provision-runner.yml b/.github/workflows/provision-runner.yml index 87d4de0..946c250 100644 --- a/.github/workflows/provision-runner.yml +++ b/.github/workflows/provision-runner.yml @@ -94,14 +94,14 @@ jobs: Write-Output "Listing all available services to identify the GitHub Actions Runner service..." Get-Service | Select-Object Name, DisplayName, Status, StartName - # Attempt to find the GitHub Actions Runner service with a more generalized matching + # Attempt to find the GitHub Actions Runner service with a broader match Write-Output "Attempting to find the GitHub Actions Runner service..." $serviceName = Get-Service | Where-Object { - $_.DisplayName -like '*GitHub*Runner*' -or $_.Name -like '*actions.runner*' + ($_.DisplayName -like '*GitHub*Runner*') -or ($_.Name -like '*actions.runner*') -or ($_.DisplayName -like '*actions*') -or ($_.Name -like '*runner*') } | Select-Object -ExpandProperty Name -First 1 if (-not $serviceName) { - Write-Error "GitHub Actions runner service not found." + Write-Error "GitHub Actions runner service not found. Please verify the runner service name." exit 1 } From 2dab96082c86e991062baafe18115e6adf8e6b1f Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 27 Nov 2024 19:51:48 +0200 Subject: [PATCH 79/79] fix vscode installation path Signed-off-by: midays --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 73c1829..44d1e12 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -41,7 +41,7 @@ jobs: run: | $nodePath = 'C:\Program Files\nodejs' - $vscodePath = 'C:/Users/nonadmin/AppData/Local/Programs/Microsoft VS Code/Code.exe' + $vscodePath = 'C:/Users/nonadmin/AppData/Local/Programs/Microsoft VS Code/' # Update PATH so that Node.js, npm, npx, and VSCode can be called directly $newPath = "$env:PATH;$nodePath;$vscodePath"