Test, build a package and upload to repo Downloads

Nelson Insignares
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 30, 2023

I have a package that I don't need to publish it into PyPi because it is for internal use only, so I wrote this pipeline that automate testing and deployment as zip file. But I need to upload it into repo downloads:

image: python:3.10

pipelines:
branches:
master:
- step:
name: Test and Build
script:
- pip install -r requirements.txt
- pip install coverage
- python -m coverage run -m unittest discover -v -s .\tests\ -p '*_tests.py'
- python -m coverage report
- step:
name: Check coverage and build package
script:
- python -m coverage report --fail-under=95
- if [[ $? -eq 0 ]]; then python setup.py sdist --formats zip; fi
- if [[ -e dist/*.zip ]]; then echo "Zip file exists"; fi
artifacts:
- dist/*.zip
- step:
name: Deploy to repo downloads
script:
- pipe: atlassian/bitbucket-upload-file:0.5.0
variables:
FILENAME: dist/*.zip

 

It is failing to execute, I can't figure out what it is.

 

Thanks for your help.

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 31, 2023

Hey @Nelson Insignares and thank you for reaching out to Community!

From your description, I assume the error is happening on the pipe atlassian/bitbucket-upload-file

By looking at the yml file you shared, it seems the pipe definition is lacking the required variables for authentication. As this pipe will execute API calls under the hood, you need to provide the credentials for authentication. Currently, that particular pipe supports basic authentication or access tokens, as the following examples : 

  • Basic authentication 

    If you choose to use basic auth, you will need to provide a bitbucket username (which you can get from Bitbucket Personal Settings page) and an App Password (you can Create an App password if you haven't already) as the credentials for authentication. 
    Permissions required for the app password -  repo:read and repo:write
    script: 
    - pipe: atlassian/bitbucket-upload-file:0.5.0
    variables:
    BITBUCKET_USERNAME: $BITBUCKET_USERNAME
    BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
    FILENAME: 'dist/*.zip'
  • Access Token

    An access token will be used for authentication. You can refer to Access Token | Bitbucket Cloud to create an access token. Please note that Project and Workspace access tokens are only available to Premium subscriptions.
    Permissions required for the access token -  repo:read and repo:write
    script:
      - pipe: atlassian/bitbucket-upload-file:0.5.0
        variables:
          BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN
          FILENAME: 'dist/*.zip'

For more details and additional examples on the configuration of that pipe, you can refer to its official documentation below :

You can try using the suggestion above to include the authentication and let us know how it goes!

If you are still facing the error after those changes, please share with us what exact command/section is erroring out and which is the full error log, so we can assist you further.

Thank you, @Nelson Insignares !

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