You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Bitbucket Pipeline部署Dev环境报错:RevisionDoesNotExistException

问题:Bitbucket Pipeline部署至AWS CodeDeploy时出现RevisionDoesNotExistException错误

我配置的Bitbucket Pipeline前几步执行均无异常,但手动触发部署到Development环境时,抛出以下错误:

✖ Failed to fetch revision.. An error occurred (RevisionDoesNotExistException) when calling the GetApplicationRevision operation: No application revision found for revision.

已确认IAM权限配置正确、S3存储桶中存在对应版本包且路径配置无误,恳请协助排查解决。

完整Pipeline配置

image: atlassian/default-image:3

pipelines:
  default:
    - step:
        name: Grant Maven Access
        script:
          - apt-get update
          - apt-get install -y maven
          - echo "Maven installed and updated"
        caches:
          - maven
        after-script:
          - pipe: atlassian/checkstyle-report:0.3.0

    - step:
        name: Test
        script:
          - chmod +x mvnw
          - ./mvnw verify --file pom.xml
          - echo "Testing done"

    - step:
        name: Build
        script:
          - ls -la  # Debugging: List files in the current directory
          - chmod +x mvnw
          - ./mvnw package -DskipTests
          - ls target
          - zip -j application.zip target/*.jar
          - echo "Build Created"
        artifacts:
          - application.zip   
          
    - step:
       name: Debugging
       script:
        - pwd  # Print current working directory
        - ls -la  # List files in the current directory
        - ls -la /opt/atlassian/pipelines/agent/build  # List files in the build directory
        
    - step:
        name: Prepare for Upload
        script:
          - mkdir -p /opt/atlassian/pipelines/agent/build/upload_folder  # Create a new folder for upload if it doesn't exist
          - mv /opt/atlassian/pipelines/agent/build/application.zip /opt/atlassian/pipelines/agent/build/upload_folder/
          - mv /opt/atlassian/pipelines/agent/build/appspec.yml /opt/atlassian/pipelines/agent/build/upload_folder/
          - mv /opt/atlassian/pipelines/agent/build/start_server.sh /opt/atlassian/pipelines/agent/build/upload_folder/
          - mv /opt/atlassian/pipelines/agent/build/stop_server.sh /opt/atlassian/pipelines/agent/build/upload_folder/
        artifacts:
          - upload_folder/application.zip  # Make the new folder and application.zip an artifact
          - upload_folder/appspec.yml
          - upload_folder/start_server.sh
          - upload_folder/stop_server.sh
  
    - step:
        name: Upload to S3
        script:
          - pipe: atlassian/aws-s3-deploy:0.4.4
            variables:
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID_1
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY_1
              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
              S3_BUCKET: 'abc'
              LOCAL_PATH: "/opt/atlassian/pipelines/agent/build/upload_folder"
              APPLICATION_NAME: "def"
          - echo "Uploaded application.zip, appspec.yml, start_server.sh and stop_server.sh to S3"

    - step:
        name: Deploy to Development
        deployment: Development
        trigger: manual
        script:
          - ls -la  # Debugging: List files in the current directory
          - ls -la upload_folder  # Debugging
          - pipe: atlassian/aws-code-deploy:1.4.0
            variables:
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID_1
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY_1
              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
              DEBUG: 'true'
              COMMAND: "deploy"
              APPLICATION_NAME: "def"
              DEPLOYMENT_GROUP: "xyz"
              S3_BUCKET: 'abc'
              S3_KEY: "application.zip"
              ZIP_FILE: "upload_folder/application.zip"

问题排查与修复方案

1. S3_KEY路径配置错误

在Upload to S3步骤中,设置了APPLICATION_NAME: "def",这会导致atlassian/aws-s3-deploy管道将LOCAL_PATH下的文件上传到S3桶的def/目录下,而非根目录。当前Deploy to Development步骤中S3_KEY: "application.zip"指向的是桶根目录,与实际存储路径不符。

2. 冗余的ZIP_FILE参数

使用S3作为CodeDeploy的修订源时,无需设置ZIP_FILE参数(该参数用于本地文件直接部署场景),保留会导致管道混淆源位置。

修改后的Deploy步骤配置

- step:
    name: Deploy to Development
    deployment: Development
    trigger: manual
    script:
      - ls -la  # Debugging: List files in the current directory
      - ls -la upload_folder  # Debugging
      - pipe: atlassian/aws-code-deploy:1.4.0
        variables:
          AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID_1
          AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY_1
          AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
          DEBUG: 'true'
          COMMAND: "deploy"
          APPLICATION_NAME: "def"
          DEPLOYMENT_GROUP: "xyz"
          S3_BUCKET: 'abc'
          S3_KEY: "def/application.zip"

额外验证建议

  • 在Upload to S3步骤后添加调试命令,确认文件在S3的实际路径:
    - aws s3 ls s3://abc/def/
    
  • 检查CodeDeploy应用程序的修订源配置,确保与S3路径完全匹配。

内容的提问来源于stack exchange,提问作者Vibhor

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 02:45:23