0
votes

I have a .sh script within a folder, and I'm using Azure DevOps to generate a tar.gz file that has that shell script.

Sample Folder Structure

main_folder/boot.sh

I'm using the ArchiveFiles@2 task found within Azure DevOps to create that archive, with the following settings:

- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: "main_folder"
    includeRootFolder: false
    archiveType: "tar"
    tarCompression: "gz"
    archiveFile: "$(Build.StagingDirectory)/update.tar.gz
    replaceExistingArchive: true

However, after I release this build and extract the tar.gz on my Linux system, when I try to run boot.sh it says that permission is denied and I have to use chmod u=rwx boot.sh to add the "execute" permission. Is there some way to check how Azure DevOps determines what permissions are added/removed when archiving?

1

1 Answers

1
votes

The task ArchiveFiles doesnot change the files permissions while archiving. I tested on my pipeline to archive a .sh file and extract the tar.gz on the linux system. The permissions of .sh file remained the same. So the issue you encountered above might because the origin boot.sh doesnot have the execute permission.

You can run the command ls -l main_folder/boot.sh to check the file's permission before achiving. And add the permission if it doesnot have execute permission.

- bash: |
      
   ls -l main_folder/boot.sh  
   chmod u=rwx main_folder/boot.sh

- task: ArchiveFiles@2