我有一个多分支管道,在一个脚本管道(来自库)中定义,它协调大约 100 个构建,每个构建跨多个从属(不同的操作系统)。操作系统之一是 Windows,它具有 255 个字符的路径限制。因为我们的一些作业中有大约 200 个字符路径(我们无法控制,因为它是供应商提供的地狱),所以我需要更改 Windows 从站上的步骤/节点工作区,最好使用 node()步骤,以便 git 仅在自定义工作区中自动检出一次。
我尝试了各种不同的风格:
这适用于声明性管道:
stage('blah') {
node {
label 'win'
customWorkspace "c:\\w\\${JOB_NAME"
}
steps {
...
}
}
Run Code Online (Sandbox Code Playgroud)
但我找不到脚本管道的等效项:
pipeline {
stage('stage1') {
node('win-node') {
// the git repository is checked out to ${env.WORKSPACE}, but it's unusable due to the path length issue
ws("c:\\w\\${JOB_NAME}") {
// this switches the workspace, but doesn't clone the git repo again
body()
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
理想情况下,我想要这样的东西:
pipeline {
stage('stage1') {
node('win-node', ws="c:\\w\\${JOB_NAME}") …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将exiftool
生成的JSON通过psql
有效插入到Postgresql中。似乎以某种方式使转义的单引号和转义的双引号无法正常工作。我不知道如何正确转义json。似乎psql在将\“引导到psql而不是查询时,没有正确处理单引号转义。
给定这张表
create table test (exif jsonb);
Run Code Online (Sandbox Code Playgroud)
这些工作:
test=> insert into test values ('{"a": 1, "b": "2"}');
INSERT 0 1
test=> insert into test values ('{"a": 1, "b": "2\""}');
INSERT 0 1
test=> select * from test;
exif
----------------------
{"a": 1, "b": "2"}
{"a": 1, "b": "2\""}
Run Code Online (Sandbox Code Playgroud)
但是这些不
test=> insert into test values ('{"a": 1, "b": "1\' 2\""}');
Invalid command \""}');. Try \? for help.
test=> select '{"a": 1, "b": "1' 2\""}';
Invalid command \""}';. Try …
Run Code Online (Sandbox Code Playgroud)