失败的bitbucket nodejs repo Pipeline带有AWS lambda功能的“错误解析参数” - zip-file .....................................................................................................................................................................................................'' &quot

发布于 2025-02-02 07:04:01 字数 1473 浏览 4 评论 0原文

我们的团队正在遇到问题,试图设置一个管道来更新AWS lambda功能。

一旦触发了部署,就会出现以下错误失败:

Status: Downloaded newer image for bitbucketpipelines/aws-lambda-deploy:0.2.3
INFO: Updating Lambda function.
aws lambda update-function-code --function-name apikey-token-authorizer2 --publish --zip-file fileb://apiGatewayAuthorizer.zip
Error parsing parameter '--zip-file': Unable to load paramfile fileb://apiGatewayAuthorizer.zip: [Errno 2] No such file or directory: 'apiGatewayAuthorizer.zip'
*Failed to update Lambda function code.

看起来脚本找不到工件,但我们不知道为什么。

这是bitbucket pipelines.yml文件内容:

    image: node:16
# Workflow Configuration
pipelines:
default:
 - parallel:
 - step:
name: Build and Test
caches:
 - node
script:
 - echo Installing source YARN dependencies.
 - yarn install

branches:
testing:
 - parallel:
 - step:
name: Build 
script:
 - apt update && apt install zip
# Exclude files to be ignored
 - echo Zipping package.
 - zip -r apiGatewayAuthorizer.zip . -x *.git* bitbucket-pipelines.yml

artifacts:
 - apiGatewayAuthorizer.zip
- step:
name: Deploy to testing - Update Lambda code
deployment: Test
trigger: manual
script:
 - pipe: atlassian/aws-lambda-deploy:0.2.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
FUNCTION_NAME: $LAMBDA_FUNCTION_NAME
COMMAND: 'update'
ZIP_FILE: 'apiGatewayAuthorizer.zip'

有人知道我在这里缺少什么吗?

Our team is having a problem trying to set up a pipeline for update an AWS Lambda function.

Once the deploy is triggered, it fails with the following error:

Status: Downloaded newer image for bitbucketpipelines/aws-lambda-deploy:0.2.3
INFO: Updating Lambda function.
aws lambda update-function-code --function-name apikey-token-authorizer2 --publish --zip-file fileb://apiGatewayAuthorizer.zip
Error parsing parameter '--zip-file': Unable to load paramfile fileb://apiGatewayAuthorizer.zip: [Errno 2] No such file or directory: 'apiGatewayAuthorizer.zip'
*Failed to update Lambda function code.

Looks like the script couldn't find the artifact, but we don't know why.

Here is the bitbucket-pipelines.yml file content:

    image: node:16
# Workflow Configuration
pipelines:
default:
 - parallel:
 - step:
name: Build and Test
caches:
 - node
script:
 - echo Installing source YARN dependencies.
 - yarn install

branches:
testing:
 - parallel:
 - step:
name: Build 
script:
 - apt update && apt install zip
# Exclude files to be ignored
 - echo Zipping package.
 - zip -r apiGatewayAuthorizer.zip . -x *.git* bitbucket-pipelines.yml

artifacts:
 - apiGatewayAuthorizer.zip
- step:
name: Deploy to testing - Update Lambda code
deployment: Test
trigger: manual
script:
 - pipe: atlassian/aws-lambda-deploy:0.2.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
FUNCTION_NAME: $LAMBDA_FUNCTION_NAME
COMMAND: 'update'
ZIP_FILE: 'apiGatewayAuthorizer.zip'

Does anyone knows what am I missing here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一影成城 2025-02-09 07:04:01

多亏了来自Atlassian的Marc C.,这是解决方案。

基于您的YAML配置,我可以看到您正在使用并行
步骤。

根据文档:

并行步骤只能使用以前的步骤生成的伪影,而不是
通过同一并行集中的步骤。

因此,这就是为什么未在“构建”步骤中生成工件的原因
因为这两个步骤在平行集内。

为此,您可以删除并行配置并使用
多步。这样,第一步可以生成
人工制品并将其传递到第二步。希望它有帮助,让我
知道它的发展。

标记C

,我们已经尝试了解决方案,并且奏效了!
这是新管道:

    pipelines:
  branches:
    testing:
        - step:
            name: Build and Test
            caches:
              - node
            script:
              - echo Installing source YARN dependencies.
              - yarn install
              - apt update && apt install zip
              # Exclude files to be ignored
              - echo Zipping package.
              - zip -r my-deploy.zip . -x *.git* bitbucket-pipelines.yml
            artifacts:
              - my-deploy.zip
        - step:
            name: Deploy to testing - Update Lambda code
            deployment: Test
            trigger: manual
            script:
              - pipe: atlassian/aws-lambda-deploy:0.2.3
                variables:
                  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
                  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
                  AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
                  FUNCTION_NAME: $LAMBDA_FUNCTION_NAME
                  COMMAND: 'update'
                  ZIP_FILE: 'my-deploy.zip'
                            
         
        

Thanks to Marc C. from Atlassian, here is the solution.

Based on your YAML configuration, I can see that you're using Parallel
steps.

According to the documentation:

Parallel steps can only use artifacts produced by previous steps, not
by steps in the same parallel set.

Hence, this is why the artifacts is not generated in the "Build" step
because those 2 steps are within a parallel set.

For that, you can just remove the parallel configuration and use
multi-steps instead. This way, the first step can generate the
artifact and pass it on to the second step. Hope it helps and let me
know how it goes.

Regards, Mark C

So we've tried the solution and it worked!.
Here is the new pipeline:

    pipelines:
  branches:
    testing:
        - step:
            name: Build and Test
            caches:
              - node
            script:
              - echo Installing source YARN dependencies.
              - yarn install
              - apt update && apt install zip
              # Exclude files to be ignored
              - echo Zipping package.
              - zip -r my-deploy.zip . -x *.git* bitbucket-pipelines.yml
            artifacts:
              - my-deploy.zip
        - step:
            name: Deploy to testing - Update Lambda code
            deployment: Test
            trigger: manual
            script:
              - pipe: atlassian/aws-lambda-deploy:0.2.3
                variables:
                  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
                  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
                  AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
                  FUNCTION_NAME: $LAMBDA_FUNCTION_NAME
                  COMMAND: 'update'
                  ZIP_FILE: 'my-deploy.zip'
                            
         
        
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文