Folder is not publishing on bitbucket pipeline
Asked by Ci Admin:

I have been trying to build and publish a project using bitbucket pipelines and when its done I'm saving the published folder as an artifact in my pipeline but it isn't being saved.  
Following is my pipeline:
>
> ```
> image: mcr.microsoft.com/dotnet/core/sdk:3.1
> pipelines: branches: staging: - step: name: Build and Test caches: - dotnetcore script: - cd Tracs4Life - dotnet restore - dotnet build --no-restore --configuration Release - dotnet publish --configuration Release --no-build ./Tracs4Life.Website/Tracs4Life.Website.csproj -o ./publish - ls artifacts: - publish/**
> ```
>
> Here are the logs:

    + cd Tracs4Life

    + dotnet restore  Determining projects to restore...  Restored /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Admin/Tracs4Life.Admin.csproj (in 442 ms).  Restored /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Model/Tracs4Life.Model.csproj (in 499 ms).  Restored /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Service/Tracs4Life.Service.csproj (in 523 ms).  Restored /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Common/Tracs4Life.Common.csproj (in 134 ms).  Restored /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Website/Tracs4Life.Website.csproj (in 586 ms).  Restored /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Interface/Tracs4Life.Interface.csproj (in 131 ms).  Restored /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Repository/Tracs4Life.Repository.csproj (in 154 ms).

    + dotnet build --no-restore --configuration ReleaseMicrosoft (R) Build Engine version 16.7.2+b60ddb6f4 for .NETCopyright (C) Microsoft Corporation. All rights reserved.  Tracs4Life.Admin -> /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Admin/bin/Release/netcoreapp3.1/Tracs4Life.Admin.dll  Tracs4Life.Admin -> /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Admin/bin/Release/netcoreapp3.1/Tracs4Life.Admin.Views.dllDomain/TrainingTracs4LifeContext.cs(328,10): warning CS1030: #warning: 'To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.' [/opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Model/Tracs4Life.Model.csproj]  Tracs4Life.Model -> /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Model/bin/Release/netcoreapp3.1/Tracs4Life.Model.dll  Tracs4Life.Interface -> /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Interface/bin/Release/netcoreapp3.1/Tracs4Life.Interface.dll  Tracs4Life.Common -> /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Common/bin/Release/netcoreapp3.1/Tracs4Life.Common.dll  Tracs4Life.Repository -> /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Repository/bin/Release/netcoreapp3.1/Tracs4Life.Repository.dllFacilityService.cs(21,46): warning CS0649: Field 'FacilityService._claimHelperService' is never assigned to, and will always have its default value null [/opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Service/Tracs4Life.Service.csproj]  Tracs4Life.Service -> /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Service/bin/Release/netcoreapp3.1/Tracs4Life.Service.dllControllers/HomeController.cs(55,13): warning CS0162: Unreachable code detected [/opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Website/Tracs4Life.Website.csproj]  http://Tracs4Life.Website -> /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Website/bin/Release/netcoreapp3.1/Tracs4Life.Website.dll  http://Tracs4Life.Website -> /opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Website/bin/Release/netcoreapp3.1/Tracs4Life.Website.Views.dllBuild succeeded.Domain/TrainingTracs4LifeContext.cs(328,10): warning CS1030: #warning: 'To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.' [/opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Model/Tracs4Life.Model.csproj]FacilityService.cs(21,46): warning CS0649: Field 'FacilityService._claimHelperService' is never assigned to, and will always have its default value null [/opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Service/Tracs4Life.Service.csproj]Controllers/HomeController.cs(55,13): warning CS0162: Unreachable code detected [/opt/atlassian/pipelines/agent/build/Tracs4Life/Tracs4Life.Website/Tracs4Life.Website.csproj]    3 Warning(s)    0 Error(s)Time Elapsed 00:00:13.15

    + dotnet publish --configuration Release --no-build ./Tracs4Life.Website/Tracs4Life.Website.csproj -o ./publishMicrosoft (R) Build Engine version 16.7.2+b60ddb6f4 for .NETCopyright (C) Microsoft Corporation. All rights reserved.  http://Tracs4Life.Website -> /opt/atlassian/pipelines/agent/build/Tracs4Life/publish/

    +ls
    Tracs4Life.AdminTracs4Life.CommonTracs4Life.InterfaceTracs4Life.ModelTracs4Life.RepositoryTracs4Life.Servicehttp://Tracs4Life.WebsiteTracs4Life.slnfrontendpublish

>     You already have a 'dotnetcore' cache so we won't create it againSearching for files matching artifact pattern publish/**Searching for test report files in directories named [test-results, failsafe-reports, test-reports, surefire-reports] down to a depth of 4Finished scanning for test reports. Found 0 test report files.Merged test suites, total number tests is 0, with 0 failures and 0 errors.

Even though the publish folder is present but it's still not archiving any artifacts.![Capture.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/125759iD761A4F743404032/image-size/large?v=v2&px=999 "Capture.PNG")


Answers:
author: Amit Dobhal
body: i have same issue, You already have a 'dotnetcore' cache so we won't create it again.please let me know the solution


author: Theodora Boudale
body: Hi [@Ci Admin](/t5/user/viewprofilepage/user-id/2678316) ,

From the output of the build, I cannot see any obvious reason why the artifacts are not uploaded.

I believe there is a limit of 1 GB for artifacts. One possibility that I can think of is that maybe the size of the publish directory is more than that.

Could you include the following command at the end of your script in your yml file, after the ls command, to check the size of the publish directory?

```
du -sh publish
```

Please let me know what the output is and then we take it from there.

Kind regards,  
Theodora

comments: author: Ci Admin
body: This is is the output:

92M publish


author: Theodora Boudale
body: Hi [@Ci Admin](/t5/user/viewprofilepage/user-id/2678316) ,

Thank you for the output, the size of the acrtifacts does not seem to be an issue.

I've discussed this with my colleagues, one more thing to check would be if *publish* is actually a directory or a file, which you can check with the command:

```
ls -lah
```

If it is a directory, you'll see the letter **d** before the permissions.

If this is indeed a directory, my suggestion would be to open a ticket with the support team, so they can check this specific build and additional logs from our side, and figure out what is causing this.

You can open a ticket via <https://support.atlassian.com/contact/#/>, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. You can include the link of this Community post in the "Give us more details" field, so you don't have to explain everything again, and please include the URL of the build with this issue.

I can also open the ticket for you if you like, just let me know.

Kind regards,  
Theodora


author: Ci Admin
body: Hi [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086),

Kindly go ahead and open the ticket for me. let me know if anything else is needed from my side. I'll provide the additional logs as well.


author: Theodora Boudale
body: Hi [@Ci Admin](/t5/user/viewprofilepage/user-id/2678316) ,

Of course, I have opened a support ticket for you, you should have received an email about this to the email that you use for your Community account.

In the content of the email you will find the link to the support ticket.

I would like to ask if you could post in the support ticket the URL of a recent build where you see this issue, so the engineer working on your case can better help you. The support ticket is visible only to you and Atlassian staff.

If you have any questions, please feel free to let me know.

Kind regards,  
Theodora


Tags: artefact

bitbucket-pipelines

cloud