174 строки
5.3 KiB
YAML
Executable File
174 строки
5.3 KiB
YAML
Executable File
parameters:
|
|
- name: root_dir
|
|
type: string
|
|
- name: working_directory
|
|
type: string
|
|
- name: mount_dir
|
|
type: string
|
|
- name: temp_dir
|
|
type: string
|
|
- name: hostedAgent
|
|
type: boolean
|
|
default: true
|
|
- name: gopath
|
|
type: string
|
|
- name: container
|
|
type: string
|
|
- name: skip_msi
|
|
type: string
|
|
default: "true"
|
|
- name: skip_azcli
|
|
type: string
|
|
default: "true"
|
|
- name: proxy_address
|
|
type: string
|
|
default: ""
|
|
- name: skip_ut
|
|
type: boolean
|
|
default: false
|
|
- name: tags
|
|
type: string
|
|
default: "null"
|
|
- name: fuselib
|
|
type: string
|
|
default: "fuse3 libfuse3-dev"
|
|
|
|
steps:
|
|
# Package manager installs for libfuse
|
|
- script: |
|
|
sudo apt-get update --fix-missing
|
|
sudo apt-get install ${{ parameters.fuselib }} -y
|
|
fusermount -V
|
|
displayName: 'Libfuse Setup'
|
|
condition: eq('${{ parameters.hostedAgent }}', true)
|
|
|
|
# Custom script to install Go-lang
|
|
- task: ShellScript@2
|
|
inputs:
|
|
scriptPath: "${{ parameters.working_directory }}/go_installer.sh"
|
|
args: "${{ parameters.root_dir }}/"
|
|
displayName: "GoTool Custom Setup"
|
|
|
|
# Downloading Go dependency packages
|
|
- task: Go@0
|
|
inputs:
|
|
command: 'get'
|
|
arguments: '-d'
|
|
workingDirectory: ${{ parameters.working_directory }}
|
|
displayName: "Go Get"
|
|
|
|
# Building our package
|
|
- task: Go@0
|
|
inputs:
|
|
command: 'build'
|
|
arguments: "-tags ${{ parameters.tags }} -o blobfuse2"
|
|
workingDirectory: ${{ parameters.working_directory }}
|
|
displayName: "Go Build"
|
|
|
|
# Building our package
|
|
- task: Go@0
|
|
inputs:
|
|
command: 'build'
|
|
arguments: "-tags ${{ parameters.tags }} -o bfusemon ./tools/health-monitor/"
|
|
workingDirectory: ${{ parameters.working_directory }}
|
|
displayName: "Go Build bfusemon"
|
|
|
|
#Verification of built binary
|
|
- script: |
|
|
sudo chmod +x ${working_directory}/blobfuse2
|
|
${working_directory}/blobfuse2 --version
|
|
displayName: 'Test binary'
|
|
env:
|
|
working_directory: ${{ parameters.working_directory }}
|
|
|
|
# Creating necessary directories
|
|
- script: |
|
|
sudo fusermount -u ${mount_dir}
|
|
sudo fusermount3 -u ${mount_dir}
|
|
rm -rf ${mount_dir}
|
|
mkdir -p ${mount_dir}
|
|
echo "Creating mount dir " ${mount_dir}
|
|
displayName: 'Create Mount directory'
|
|
env:
|
|
mount_dir: ${{ parameters.mount_dir }}
|
|
|
|
- script: |
|
|
mkdir -p ${temp_dir}
|
|
echo "Creating temp dir " ${temp_dir}
|
|
displayName: "Create Cache directory"
|
|
env:
|
|
temp_dir: ${{ parameters.temp_dir }}
|
|
|
|
- script: |
|
|
mkdir -p ${gopath}/src
|
|
echo "Creating gopath " ${gopath}
|
|
displayName: "Create Gopath"
|
|
env:
|
|
gopath: ${{ parameters.gopath }}
|
|
|
|
- script: |
|
|
cnfFile=$HOME/azuretest.json
|
|
echo $cnfFile
|
|
touch $cnfFile
|
|
echo "{" > $cnfFile
|
|
echo "\"block-acct\"": "\"$(AZTEST_BLOCK_ACC_NAME)\"", >> $cnfFile
|
|
echo "\"adls-acct\"": "\"$(AZTEST_ADLS_ACC_NAME)\"", >> $cnfFile
|
|
echo "\"block-cont\"": "\"${{ parameters.container }}\"", >> $cnfFile
|
|
echo "\"adls-cont\"": "\"${{ parameters.container }}\"", >> $cnfFile
|
|
echo "\"block-key\"": "\"$(AZTEST_BLOCK_KEY)\"", >> $cnfFile
|
|
echo "\"adls-key\"": "\"$(AZTEST_ADLS_KEY)\"", >> $cnfFile
|
|
echo "\"block-sas\"": "\"$(AZTEST_BLOCK_SAS)\"", >> $cnfFile
|
|
echo "\"block-cont-sas-ubn-18\"": "\"$(AZTEST_BLOCK_CONT_SAS_UBN_18)\"", >> $cnfFile
|
|
echo "\"block-cont-sas-ubn-20\"": "\"$(AZTEST_BLOCK_CONT_SAS_UBN_20)\"", >> $cnfFile
|
|
echo "\"adls-sas\"": "\"$(AZTEST_ADLS_SAS)\"", >> $cnfFile
|
|
echo "\"msi-appid\"": "\"$(AZTEST_APP_ID)\"", >> $cnfFile
|
|
echo "\"msi-resid\"": "\"$(AZTEST_RES_ID)\"", >> $cnfFile
|
|
echo "\"msi-objid\"": "\"$(AZTEST_OBJ_ID)\"", >> $cnfFile
|
|
echo "\"skip-msi\"": "${{ parameters.skip_msi }}", >> $cnfFile
|
|
echo "\"skip-azcli\"": "${{ parameters.skip_azcli }}", >> $cnfFile
|
|
echo "\"proxy-address\"": "\"${{ parameters.proxy_address }}\"" >> $cnfFile
|
|
|
|
echo "}" >> $cnfFile
|
|
cat $cnfFile
|
|
displayName: "Create AzureTest Config"
|
|
continueOnError: false
|
|
workingDirectory: ${{ parameters.working_directory }}
|
|
|
|
# Install azcli
|
|
- script: |
|
|
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
|
az --version
|
|
displayName: 'Install Azure CLI'
|
|
condition: eq('${{ parameters.skip_azcli }}', 'false')
|
|
|
|
# azcli login
|
|
- script: |
|
|
az login --identity --username $(ACLI_BLOBFUSE_MSI_APP_ID)
|
|
displayName: 'Azure CLI login'
|
|
condition: eq('${{ parameters.skip_azcli }}', 'false')
|
|
|
|
# Running unit tests
|
|
- task: Go@0
|
|
condition: eq('${{ parameters.skip_ut }}', 'false')
|
|
inputs:
|
|
command: 'test'
|
|
arguments: '-v -timeout=1h ./... --tags=unittest,${{ parameters.tags }} -coverprofile utcover.cov'
|
|
workingDirectory: ${{ parameters.working_directory }}
|
|
displayName: 'Unit tests'
|
|
continueOnError: true
|
|
|
|
- task: Go@0
|
|
condition: eq('${{ parameters.skip_ut }}', 'false')
|
|
inputs:
|
|
command: 'tool'
|
|
arguments: 'cover -func utcover.cov'
|
|
workingDirectory: ${{ parameters.working_directory }}
|
|
displayName: 'Code Coverage Report'
|
|
continueOnError: true
|
|
|
|
- script: |
|
|
cp ./utcover.cov $(Build.ArtifactStagingDirectory)/
|
|
rm -rf ./utcover.cov
|
|
workingDirectory: ${{ parameters.working_directory }}
|
|
displayName: "Save coverage report"
|