Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,34 @@ pipeline {
}
steps {
script {
//env.pqBrowserDockerTag = env.CHANGE_BRANCH == "${env.devBranch}" ? "${env.pqBrowserVersion}a" : env.pqBrowserVersion
//println("Building PQBrowser Docker image tag: pqbrowser:${env.pqBrowserDockerTag}")
println("Skipping docker stage intentionally")
env.pqBrowserDockerTag = env.CHANGE_BRANCH == "${env.devBranch}" ? "${env.pqBrowserVersion}a" : env.pqBrowserVersion
println("Building PQBrowser Docker image tag: pqbrowser:${env.pqBrowserDockerTag}")
}

/*powershell """
powershell """
dotnet publish '.\\PQBrowser\\PQBrowser.csproj' `
--configuration Release `
'-p:PublishProfile=Docker Release Profile PQBrowser'
"""

powershell "docker build --build-arg CONFIGURATION=Release -f .\\PQBrowser.dockerfile -t pqbrowser:${env.pqBrowserDockerTag} ."
*/
withCredentials([
string(credentialsId: 'wsl-docker-user', variable: 'WSL_DOCKER_USER')
]) {
powershell '''
$key = 'C:\\ProgramData\\Jenkins\\.ssh\\wsl_docker'
$wslPath = '/mnt/' + $env:WORKSPACE.Substring(0, 1).ToLowerInvariant() + $env:WORKSPACE.Substring(2).Replace('\\', '/')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an issue. This is a Groovy ''' string, which still processes backslash escapes (it only disables $ interpolation). So the Jenkinsfile source:

.Replace('\\', '/')

reaches PowerShell as:

.Replace('\', '/')

which is a single literal backslash, and String.Replace is not regex. Result: /mnt/c/Jenkins/workspace/.... The existing dotnet publish line in this file relies on the same escaping.


ssh -i $key `
-o BatchMode=yes `
-p 2222 `
"$env:WSL_DOCKER_USER@localhost" `
"cd '$wslPath' && docker info --format '{{.OSType}}' && docker build --build-arg CONFIGURATION=Release -f ./PQBrowser.dockerfile -t 'pqbrowser:$env:pqBrowserDockerTag' ."

if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
'''
}
}
}

Expand Down
Loading