【发布时间】:2021-01-27 09:28:52
【问题描述】:
希望你们中的一个可以提供帮助-我正在jenkins管道中运行一个脚本,以便我可以将源地图上传到rollbar,所以我需要遍历缩小的js文件-我正在尝试使用FIND命令但是它一直给我一个错误:find parameter format not correct - 下面的脚本:
stages {
stage('Set correct environment link') {
steps {
script {
buildTarget = params.targetEnv
if(params.targetEnv.equals("prj1")){
linkTarget = "http://xxx.xxx.xx/xxx/"
} else if(params.targetEnv.equals(.......)..etc.
stage('Uploading source maps to Rollbar') {
steps {
sh ''' #!/bin/bash
# Save a short git hash, must be run from a git
# repository (or a child directory)
version=$(git rev-parse --short HEAD)
# Use the post_server_time access token, you can
# find one in your project access token settings
post_server_item=e1d04646bf614e039d0af3dec3fa03a7
echo "Uploading source maps for version $version!"
# We upload a source map for each resulting JavaScript
# file; the path depends on your build config
for path in $(find dist/renew -name "*.js"); do
# URL of the JavaScript file on the web server
url=${linkTarget}/$path
# a path to a corresponding source map file
source_map="@$path.map"
echo "Uploading source map for $url"
curl --silent --show-error https://api.rollbar.com/api/1/sourcemap \
-F access_token=$post_server_item \
-F version=$version \
-F minified_url=$url \
-F source_map=$source_map \
> /dev/null
done
'''
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
【问题讨论】:
-
请发布错误信息。你也有一个shell脚本。不是蝙蝠脚本。请更改标题。
-
在 bash 命令行中是否可以使用相同的命令?您可以检查 jenkins 是否使用不同的
find命令 (which find) -
当我从 bash CLI 运行脚本时 - 我不断收到 curl 无法连接到 api.rollbar.com 端口 443 超时 我尝试使用:post_server_item 和 post_client_item 访问令牌脚本
-
但是 find 命令在 bash CLI 中有效
-
您是否确认
dist和dist/renew都是有效路径,并且它们存在于脚本运行的位置?
标签: jenkins jenkins-pipeline path-finding rollbar