Bitbucket Pipelines - “无法识别术语'chmod*'”错误

Bitbucket Pipelines - "The term 'chmod* is not recognized" error

提问人:Isira Ratnayake 提问时间:10/24/2023 最后编辑:jessehouwingIsira Ratnayake 更新时间:10/24/2023 访问量:38

问:

我是 Bitbucket 中管道的初学者。我有一个项目,其中包含一个 .ymal 文件,我需要将其推送到 bitbucket,这将触发管道。但是,触发的管道将无法成功完成,并生成以下错误消息:

+ chmod - R +× $BITBUCKET_ CLONE DIR/*
Invoke-Expression: The term 'chmod* is not recognized as the name of a cmdlet, function, script file, or operal program. Check the spelling of the name, or if a path was included, verify that the path is correct and try aga.
At C: \…….. char: 40
"chmod -R +x $BITBUCKET_CLONE_DIR/** | Invoke-Expression
+
+ CategoryInfo
ObjectNotFound: (chmod:String) [Invoke-Expression], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException, Microsoft.PowerShell.Commands . InvokeExpressionCommand

有人可以向我解释什么是错误以及如何解决这个问题吗?

这是我的.ymal文件:

definitions:
    steps:
        step: &run_on_self_hosted_runner
            runs-on:
                - self.hosted
                - windows
                - savalktest

pipelines:
    default:
    - step:
        name: 'DA_cypress_Test Pipeline'
        image: cypress/base: 8
        <<: *run_on_self_hosted runner
        script:
                        - chmod -R + $BITBUCKET CLONE DIR/*
                        - $BITBUCKET_CLONE_DIR/DA/bitbucketscript/project-init.sh
                        #- cd background translations
                        #- npm install
                        #- npm run start &
                        #- px cypress run --browser chrome
                        #- sleep 600
        after-script:
                        echo "Exit status is :$BITBUCKET EXIT CODE"
                        - if [[$BITBUCKET_EXIT_CODE=-0]] ;then BUILD_ STATUS-"Pass"; exit 0;
        artifacts:
            - DA/reports/**
            - DA/cypress/videos/**
            - DA/cypress/screenshots/**

非常感谢任何解决此问题的帮助...... :D

yaml cypress cicd bitbucket-pipelines

评论


答:

0赞 jessehouwing 10/24/2023 #1

看起来您正在 Windows 代理上运行,是用于更改文件和文件夹“权限”的 linux 命令行工具,它不在 Windows 上使用。chmod

您可以完全省略该步骤。chmod -R + $BITBUCKET CLONE DIR/*

但看起来该步骤是在 PowerShell 而不是 bash 中执行的,因此在修复此问题后,你会遇到更多错误消息。我想,但我不确定 1005,如果您在 Windows 上运行,则必须将脚本移植到 PowerShell

评论

0赞 Isira Ratnayake 10/25/2023
非常感谢。会检查一下。🐱