You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi,
Spoiler: I am new to pipelines.
My yml looks like this:
image: mcr.microsoft.com/dotnet/sdk:8.0
pipelines:
default:
- step:
name: Publish to linux-arm
caches:
- dotnetcore
script:
- REPORTS_PATH=./test-reports/build_${BITBUCKET_BUILD_NUMBER}
- dotnet restore
- dotnet publish -r linux-arm -f net8.0 --self-contained true -p:PublishSingleFile=true
- step:
name: Put in downloads
deployment: test
script:
- pipe: atlassian/bitbucket-upload-file:0.6.0
variables:
BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN
FILENAME: "/opt/atlassian/pipelines/agent/build/bin/Release/net8.0/linux-arm/publish"
The first step completes:
MSBuild version 17.8.0+6cdef4241 for .NET
Determining projects to restore...
Restored /opt/atlassian/pipelines/agent/build/LocalTestService.csproj (in 320 ms).
LocalTestService -> /opt/atlassian/pipelines/agent/build/bin/Release/net8.0/linux-arm/LocalTestService.dll
LocalTestService -> /opt/atlassian/pipelines/agent/build/bin/Release/net8.0/linux-arm/publish/
File /opt/atlassian/pipelines/agent/build/bin/Release/net8.0/linux-arm/publish doesn't exist.
/opt/atlassian/pipelines/agent/build/bin/Release/net8.0/linux-arm/publish/* pattern does not help either.
1. What is the path I have to use to get it working?
2. Dotnet publish creates a folder with multiple files even with single file output. How can I zip them before uploading?
I have it.
image: mcr.microsoft.com/dotnet/sdk:8.0
pipelines:
default:
- step:
name: Publish to linux-arm
caches:
- dotnetcore
script:
- REPORTS_PATH=./test-reports/build_${BITBUCKET_BUILD_NUMBER}
- dotnet restore
- dotnet publish -r linux-arm -f net8.0 --self-contained true -p:PublishSingleFile=true -o /var/tmp/publish/
- tar -czvf /var/tmp/playground.tar.gz /var/tmp/publish
- |
curl -X POST --url "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" \
--header "Authorization: Bearer ${BITBUCKET_ACCESS_TOKEN}" \
--form files=@"/var/tmp/playground.tar.gz"
Where BITBUCKET_ACCESS_TOKEN is a variable added to the pipeline containing a token generated for the repository.
Hi Zörgő!
I see that you figured out a workaround, I just wanted to give you some context on why you were seeing this error and a way to use two steps:
Every step of a pipelines build runs in a separate Docker container. For every step of your build, a Docker container starts (the build container) using the image you have specified in your bitbucket-pipelines.yml file. The repo is cloned in the build container, and then the commands of the step's script are executed. When the step finishes that Docker container gets destroyed.
If you want to use in a step a file that was generated during a previous step, you will need to specify this file as an artifact:
Please keep in mind that only files that are in the BITBUCKET_CLONE_DIR (/opt/atlassian/pipelines/agent/build) at the end of a step can be configured as artifacts. Artifact paths are relative to the BITBUCKET_CLONE_DIR.
If you want to use two steps and if the artifacts are generated in the path bin/Release/net8.0/linux-arm/publish/ inside the clone dir, you can adjust the yml file from your first post as follows:
image: mcr.microsoft.com/dotnet/sdk:8.0
pipelines:
default:
- step:
name: Publish to linux-arm
caches:
- dotnetcore
script:
- REPORTS_PATH=./test-reports/build_${BITBUCKET_BUILD_NUMBER}
- dotnet restore
- dotnet publish -r linux-arm -f net8.0 --self-contained true -p:PublishSingleFile=true
artifacts:
- bin/Release/net8.0/linux-arm/publish/**
- step:
name: Put in downloads
deployment: test
script:
- pipe: atlassian/bitbucket-upload-file:0.6.0
variables:
BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN
FILENAME: "bin/Release/net8.0/linux-arm/publish/**"
You can also adjust the same way the latest version of your yml file that uses a zip file, but the zip needs to exist inside the clone dir or a subdirectory in order to define it as an artifact and use the pipe.
Please feel free to reach out if you have any questions!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.