小编man*_*oni的帖子

缺少必需的上下文类 hudson.FilePath 也许您忘记用提供此内容的步骤包围代码,例如:节点

当我在 Jenkinsfile 中加载另一个 groovy 文件时,它显示以下错误。

“缺少所需的上下文类 hudson.FilePath 也许您忘记用提供此内容的步骤包围代码,例如:节点”

我制作了一个包含函数的 groovy 文件,我想在我的声明性 Jenkinsfile 中调用它。但它显示一个错误。

My Jenkinsfile--->

def myfun = load 'testfun.groovy'
pipeline{
    agent any
    environment{
        REPO_PATH='/home/manish/Desktop'
        APP_NAME='test'
    }
    stages{
        stage('calling function'){
            steps{
                script{
                    myfun('${REPO_PATH}','${APP_NAME}')
                }
             }
         }
     }
  }
Run Code Online (Sandbox Code Playgroud)

结果 -

org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: 缺少必需的上下文类 hudson.FilePath 也许你忘了用提供这个的步骤来包围代码,例如:节点

建议我什么是正确的方法。

groovy pipeline function-call jenkins jenkins-pipeline

9
推荐指数
1
解决办法
2万
查看次数

如何解决“mountinfo 中未找到 cgroup 安装:未知”错误?

启动 docker 容器时出现以下错误。

 Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:326: applying cgroup configuration for process caused: no cgroup mount found in mountinfo: unknown
    Error: failed to start containers: postgres-11

My docker version is ----> Docker version 19.03.13-ce, build 4484c46
OS--> 
NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Run Code Online (Sandbox Code Playgroud)

先感谢您。

linux centos amazon-web-services cgroups docker

6
推荐指数
1
解决办法
1万
查看次数

如何解决 pulumi 打字稿不支持在 [Output<T>] 上调用 [toString] 的此错误?

我正在通过 pulumi typescript 创建一个 s3 存储桶,并希望在 EC2 用户数据中使用此存储桶来复制对象。以下是我的代码。

const bucket = new aws.s3.Bucket("bucket-name", {
    acl: "private",
});
Run Code Online (Sandbox Code Playgroud)

我上传了一个index.html文件,这是EC2的用户数据:-

const userData = 
`#!/bin/bash
sudo apt update -y
sudo apt install -y apache2 && sudo apt install -y awscli 
aws s3 cp s3://`+pulumi.interpolate`${bucket.id}`+`/index.html /var/www/html/index.html
sudo systemctl start apache2`;
Run Code Online (Sandbox Code Playgroud)

我使用pulumi.interpolate${bucket.id}` 来调用存储桶 ID,但是当我在 EC2 上检查用户数据时,出现以下错误。

aws s3 cp s3://Calling [toString] on an [Output<T>] is not supported.

To get the value of an Output<T> as an Output<string> consider either:
1: o.apply(v => `prefix${v}suffix`) …
Run Code Online (Sandbox Code Playgroud)

amazon-s3 amazon-web-services typescript pulumi

5
推荐指数
1
解决办法
3617
查看次数