168 строки
5.7 KiB
YAML
168 строки
5.7 KiB
YAML
# Starter pipeline
|
|
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
|
# Add steps that build, run tests, deploy, and more:
|
|
# https://aka.ms/yaml
|
|
|
|
pr:
|
|
- main
|
|
|
|
jobs:
|
|
# Ubuntu based test suite
|
|
- job: test
|
|
timeoutInMinutes: 150
|
|
displayName: Build and Test on
|
|
strategy:
|
|
matrix:
|
|
Ubuntu-20:
|
|
imageName: 'ubuntu-20.04'
|
|
containerName: 'test-cnt-ubn-20'
|
|
fuselib: 'libfuse-dev'
|
|
tags: 'fuse2'
|
|
adlsSas: $(AZTEST_ADLS_CONT_SAS_UBN_20)
|
|
Ubuntu-22:
|
|
imageName: 'ubuntu-22.04'
|
|
containerName: 'test-cnt-ubn-22'
|
|
fuselib: 'libfuse3-dev'
|
|
tags: 'fuse3'
|
|
adlsSas: $(AZTEST_ADLS_CONT_SAS_UBN_22)
|
|
|
|
pool:
|
|
vmImage: $(imageName)
|
|
variables:
|
|
- group: NightlyBlobFuse
|
|
|
|
steps:
|
|
- checkout: self
|
|
|
|
- task: GoTool@0
|
|
inputs:
|
|
version: '1.19.9'
|
|
displayName: "Select Go Version"
|
|
|
|
- task: Go@0
|
|
inputs:
|
|
command: 'get'
|
|
arguments: '-d ./...'
|
|
workingDirectory: './'
|
|
displayName: "Get Dependencies"
|
|
|
|
# Install fuse and build the code
|
|
- script: |
|
|
sudo apt-get update --fix-missing
|
|
sudo apt-get install $(fuselib) -y
|
|
displayName: 'Install libfuse'
|
|
|
|
- task: Go@0
|
|
inputs:
|
|
command: 'build'
|
|
workingDirectory: ./
|
|
arguments: "-tags $(tags) -o blobfuse2"
|
|
displayName: "Build"
|
|
|
|
- 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 "\"file-acct\"": "\"$(AZTEST_FILE_ACC_NAME)\"", >> $cnfFile
|
|
echo "\"block-cont\"": "\"$(containerName)\"", >> $cnfFile
|
|
echo "\"adls-cont\"": "\"$(containerName)\"", >> $cnfFile
|
|
cho "\"file-cont\"": "\"$(containerName)\"", >> $cnfFile
|
|
echo "\"block-key\"": "\"$(AZTEST_BLOCK_KEY)\"", >> $cnfFile
|
|
echo "\"adls-key\"": "\"$(AZTEST_ADLS_KEY)\"", >> $cnfFile
|
|
echo "\"file-key\"": "\"$(AZTEST_FILE_KEY)\"", >> $cnfFile
|
|
echo "\"block-sas\"": "\"$(AZTEST_BLOCK_SAS)\"", >> $cnfFile
|
|
echo "\"adls-sas\"": "\"$(adlsSas)\"", >> $cnfFile
|
|
echo "\"file-sas\"": "\"$(AZTEST_FILE_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 "\"msi-appid\"": "\"$(AZTEST_APP_ID)\"", >> $cnfFile
|
|
echo "\"msi-resid\"": "\"$(AZTEST_RES_ID)\"", >> $cnfFile
|
|
echo "\"msi-objid\"": "\"$(AZTEST_OBJ_ID)\"", >> $cnfFile
|
|
echo "\"spn-client\"": "\"$(AZTEST_CLIENT)\"", >> $cnfFile
|
|
echo "\"spn-tenant\"": "\"$(AZTEST_TENANT)\"", >> $cnfFile
|
|
echo "\"spn-secret\"": "\"$(AZTEST_SECRET)\"", >> $cnfFile
|
|
echo "\"skip-msi\"": "true", >> $cnfFile
|
|
echo "\"proxy-address\"": "\"\"" >> $cnfFile
|
|
echo "}" >> $cnfFile
|
|
cat $cnfFile
|
|
displayName: "Create Configuration File"
|
|
continueOnError: false
|
|
workingDirectory: ./
|
|
|
|
# Code lint checks (Static-analysis)
|
|
- script: |
|
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
|
|
$(go env GOPATH)/bin/golangci-lint --version
|
|
$(go env GOPATH)/bin/golangci-lint run --tests=false --build-tags $(tags) --skip-dirs test,common/stats_collector,common/stats_monitor --max-issues-per-linter=0 --skip-files component/libfuse/libfuse2_handler_test_wrapper.go,component/libfuse/libfuse_handler_test_wrapper.go > lint.log
|
|
result=$(cat lint.log | wc -l)
|
|
if [ $result -ne 0 ]; then
|
|
echo "-----------------------------------"
|
|
echo "Below issues are found in SA"
|
|
cat lint.log
|
|
echo "-----------------------------------"
|
|
exit 1
|
|
else
|
|
echo "-----------------------------------"
|
|
echo "No issues are found in SA"
|
|
echo "-----------------------------------"
|
|
fi
|
|
displayName: 'Static Analysis (Lint)'
|
|
condition: always()
|
|
workingDirectory: ./
|
|
|
|
# Copyright checks
|
|
- script: |
|
|
result=$(grep -L -r --include \*.go "`date +%Y` Microsoft Corporation" ./ | wc -l)
|
|
if [ $result -ne 0 ]; then
|
|
exit 1
|
|
else
|
|
echo "Copyright statements are up to date"
|
|
fi
|
|
displayName: 'Copyright check'
|
|
condition: always()
|
|
failOnStderr: true
|
|
workingDirectory: ./
|
|
|
|
# Go code formatting checks
|
|
- script: |
|
|
gofmt -s -l -d . | tee >&2
|
|
displayName: 'Go Format Check'
|
|
condition: always()
|
|
failOnStderr: true
|
|
workingDirectory: ./
|
|
|
|
# Notices files check
|
|
- script: |
|
|
./notices_fix.sh
|
|
result=$(git diff NOTICE | wc -l)
|
|
if [ $result -ne 0 ]; then
|
|
echo "Notices needs a fix. Run ./notices_fix.sh and commit NOTICE file."
|
|
exit 1
|
|
else
|
|
echo "Notices are up to date."
|
|
fi
|
|
displayName: 'Notice file check'
|
|
condition: always()
|
|
failOnStderr: true
|
|
workingDirectory: ./
|
|
|
|
# Running unit tests for fuse3 on ubn-20
|
|
- task: Go@0
|
|
inputs:
|
|
command: 'test'
|
|
arguments: '-v -timeout=2h ./... --tags=unittest,$(tags) -coverprofile utcover.cov'
|
|
workingDirectory: ./
|
|
displayName: 'Unit tests'
|
|
continueOnError: false
|
|
|
|
- task: ComponentGovernanceComponentDetection@0
|
|
inputs:
|
|
scanType: 'Register'
|
|
verbosity: 'Verbose'
|
|
alertWarningLevel: 'High'
|
|
displayName: "Component governance"
|
|
condition: always()
|