Unable to locate the Artifact

Hi Team, Here I am with another silly doubt.

I am trying upload and download the artifact but only I can able to upload the artifact while downloading it causing the issue not found issue in Github actions, Please check following image, any suggestion would be much appreciated.

image

image

1 Like

Can you share your workflow code?

1 Like

Hi @mickeygousset ,

here we go!

build-project:
name: Build Project
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Upload
uses: actions/upload-artifact@v1

name: Uipath-Build
needs: build-project
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- run: |
New-Item -Path “C:\” -ItemType “directory” -Name “uipathcli”;
Invoke-WebRequest “https://www.myget.org/F/uipath-dev/api/v2/package/UiPath.CLI/1.0.7758.25166” -OutFile “C:\uipathcli\cli.zip”;
Expand-Archive -LiteralPath “C:\uipathcli\cli.Zip” -DestinationPath “C:\uipathcli”;
- name: set env
id: vars
run: |
echo “::set-output name=version::(echo '{{env.major}}.{{env.minor}}.{{github.run_number}}’)”

     - name: checkout
       uses: actions/checkout@v2    
     - name: shellcheck      
       shell: cmd
       run: |
           call "C:\\...full path\\uipcli.exe" package pack "${{ github.workspace }}" -o "${{ github.workspace }}" -v "${{steps.vars.outputs.version}}" --outputType Tests -l en-US  

name: Deploy package
needs: Uipath-Build
runs-on: windows-latest
steps:
- name: Download a Build Artifact
uses: actions/download-artifact@v2.0.9
with:
path: {{ github.workspace }} - name: checkout uses: actions/checkout@v2 - name: shellcheck shell: cmd run: | call "C:\\full path\\uipcli.exe" package deploy "{{ github.workspace }}" “https://orchestratorurl” “tenant name” -t -a

1 Like

Hey maybe it is just the formatting in the interface, but that doesn’t look like a valid workflow file to me.

Check out this example workflow that has the upload and download artifacts in it: ndclondon2021/demo7-push-to-main.yml at db711b45e84591a5997fc9277a3bc262dd65425e · mickeygousset/ndclondon2021 · GitHub

In order to make upload and download artifact work, they have to be used in jobs all located in the same workflow file. That’s because upload-artifact attaches the artifact to the workflow run itself, and download-artifact right now only looks for files in the workflow that is running and triggered it.

Do you have this file in a public repo where I can view your code?

1 Like

Hi @mickeygousset ,

Please find the script file here.

THanks
Sukesh V

1 Like

Hey! Some more questions:

  1. Why do you have multiple checkouts of your repository? You should only need to do that once in a job usually. as the first action. You do that in Line 14. I don’t think you need lines 23,24,34,35, because you are only executing one job. I don’t see where these other checkouts are helping you.

  2. Lines 25-29 is your Upload Artifact statement. In this case you are uploading the entire repository to your workflow file. I don’t see why you need to do this, for multiple reasons:
    a) you only have one job in this workflow, so you are needing to share files between runners
    b) you really only want to upload the results of your workflow, not the entire repository
    Now, this is going to create a ZIP file attached to your workflow, which you can see if you go to your workflow run and select Artifacts.

  3. Lines 30-33. Here you are trying to download the artifacts that have been attached to this workflow run. In my previous comment, you uploaded your entire repository and it put it all in a zip file. Here, the problem is line 33. You are trying to download a file from the workflow run that doesn’t exist. YOu didn’t attach a file called D:\a\SampleRepository\SampleRepository\project.json, you attached a file called SampleRepository.zip (because {{ github.workspace }} for your run translated to that). So what you have to do here is:
    a) change line 33 to be path of SampleRepository.zip to download the zip file
    b) add another step to extract the zip file
    c) then you can access the file

But again, unless you are going to break this into multiple jobs, you don’t really need all this uploading and downloading, unless, at the end of the workflow, you want to upload some build artifacts. That’s because this single job is going to run all its steps on the same runner, so all these files are there on that runner.

2 Likes

Hi @mickeygousset,

Amazing explanation! Thank you so much for that. Here actually I am trying to build .nupkg using our organization CLI
I am assuming the Steps are like this

Step 1: Package the build using repository file project.json (Input: project.json file, Output: .nupkg), it has stored in artifactory temporarily.

refer: Code line 37- 39

Step 2: Download the .nupkg file from artifactory

Step 3: Deploy to our Orchestrator (which upcoming step)

Could you please tell me how to extract by using github method only instead of using third party library?

1 Like

I’m looking at your latest run here: Update UiPathBuild.yml · sukesh-dotcom/SampleRepository@9bb5694 · GitHub

The problem is in your shelldeploy step. You have one two many “SampleRepository” in your path to the .nupkg file.

In the workflow file: Update UiPathBuild.yml · sukesh-dotcom/SampleRepository@9bb5694 · GitHub

modify line 31 and remove the \samplerepository from the deploy step after ${{ github.workspace }}

3 Likes

Thanks a lot, @mickeygousset. Your suggestion really helped me move this forward. :pray:

1 Like