Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Pipeline fails with No such file or directory

Lokesh M May 1, 2024
This is my bitbucket pipeline file, I am trying to move zip to s3 then deploy to lambda. I am not sure this is the correct way to do but in the pipeline I am getting below error. How to fix it?
✖ /opt/atlassian/pipelines/agent/build/application.zip directory doesn't exist.

image
: node:latest

pipelines:

  default:

    - step:

        name: Install, Build, and Package

        caches:

          - node

        script:

          - npm install

          - npx tsc

          - apt-get update && apt-get install -y zip

          - zip -r application.zip . -x "*.git*" -x "bitbucket-pipelines.yml"

        artifacts:

          - application.zip

    - step:

        name: Deploy to AWS Lambda Dev

        deployment: development

        script:

          - pipe: atlassian/aws-s3-deploy:1.6.0

            variables:

              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID

              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY

              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION

              S3_BUCKET: $AWS_S3_BUCKET

              LOCAL_PATH: "$BITBUCKET_CLONE_DIR/application.zip"
          - pipe: atlassian/aws-lambda-deploy:1.11.1

            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: $AWS_FUNCTION_NAME

              COMMAND: 'update'

              S3_BUCKET: $AWS_S3_BUCKET

              S3_KEY: application.zip

2 answers

1 vote
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 3, 2024

@Lokesh M hi. Thanks for your question

✖ /opt/atlassian/pipelines/agent/build/application.zip directory doesn't exist.

This error points you that you should pass a directory not a file.
According to aws-s3-deploy README:
LOCAL_PATH - Local path to folder to be deployed.
Example:

script:
  - pipe: atlassian/aws-s3-deploy:1.6.0
    variables:
      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
      AWS_DEFAULT_REGION: 'us-east-1'
      S3_BUCKET: 'my-bucket-name'
      LOCAL_PATH: $BITBUCKET_CLONE_DIR
      EXTRA_ARGS: "--exclude=* --include=application.zip"



Regards, Igor

 

1 vote
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2024

Hello @Lokesh M and welcome to the Community!

That error message suggests the file application.zip was either not correctly generated in the first step or there were some issues with passing it as an artifact from the first step to the second due to its size.

To confirm whether the file is available in both steps, could you please add a simple ls command in the first and second steps and check for the file's existence? 

  • First step  - add the ls command right after the zip command to check if the file was created :
    [...]
    - zip -r application.zip . -x "*.git*" -x "bitbucket-pipelines.yml"

    - ls -la

    [...]
  • Second step - add the ls command as the first command in the step to see if the artifact (application.zip) was downloaded and placed in the same location where it was generated: 
    [...]
    script
    :
    - ls -la

      - pipe: atlassian/aws-s3-deploy:1.6.0

    [...]

Once you have a new build with those two commands, feel free to share the output of both of them here so we can assist you further.

Thank you, @Lokesh M !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events