2022-02-09 19:42:28 +03:00
|
|
|
# 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
|
2023-05-08 06:22:38 +03:00
|
|
|
timeoutInMinutes: 150
|
2022-02-09 19:42:28 +03:00
|
|
|
displayName: Build and Test on
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
Ubuntu-20:
|
|
|
|
imageName: 'ubuntu-20.04'
|
|
|
|
containerName: 'test-cnt-ubn-20'
|
2022-08-18 19:00:13 +03:00
|
|
|
fuselib: 'libfuse-dev'
|
|
|
|
tags: 'fuse2'
|
2022-08-02 10:22:06 +03:00
|
|
|
adlsSas: $(AZTEST_ADLS_CONT_SAS_UBN_20)
|
2022-07-28 07:39:41 +03:00
|
|
|
Ubuntu-22:
|
|
|
|
imageName: 'ubuntu-22.04'
|
|
|
|
containerName: 'test-cnt-ubn-22'
|
|
|
|
fuselib: 'libfuse3-dev'
|
|
|
|
tags: 'fuse3'
|
2022-08-02 10:22:06 +03:00
|
|
|
adlsSas: $(AZTEST_ADLS_CONT_SAS_UBN_22)
|
2022-02-09 19:42:28 +03:00
|
|
|
|
|
|
|
pool:
|
|
|
|
vmImage: $(imageName)
|
|
|
|
variables:
|
|
|
|
- group: NightlyBlobFuse
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout: self
|
|
|
|
|
|
|
|
- task: GoTool@0
|
|
|
|
inputs:
|
2023-05-10 12:23:05 +03:00
|
|
|
version: '1.19.9'
|
2022-02-09 19:42:28 +03:00
|
|
|
displayName: "Select Go Version"
|
|
|
|
|
|
|
|
- task: Go@0
|
|
|
|
inputs:
|
|
|
|
command: 'get'
|
2022-08-27 17:17:39 +03:00
|
|
|
arguments: '-d ./...'
|
2022-02-09 19:42:28 +03:00
|
|
|
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: ./
|
2022-07-27 09:49:36 +03:00
|
|
|
arguments: "-tags $(tags) -o blobfuse2"
|
2022-02-09 19:42:28 +03:00
|
|
|
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
|
2022-06-28 05:41:37 +03:00
|
|
|
echo "\"file-acct\"": "\"$(AZTEST_FILE_ACC_NAME)\"", >> $cnfFile
|
2022-02-09 19:42:28 +03:00
|
|
|
echo "\"block-cont\"": "\"$(containerName)\"", >> $cnfFile
|
|
|
|
echo "\"adls-cont\"": "\"$(containerName)\"", >> $cnfFile
|
2022-06-28 05:41:37 +03:00
|
|
|
cho "\"file-cont\"": "\"$(containerName)\"", >> $cnfFile
|
2022-02-09 19:42:28 +03:00
|
|
|
echo "\"block-key\"": "\"$(AZTEST_BLOCK_KEY)\"", >> $cnfFile
|
|
|
|
echo "\"adls-key\"": "\"$(AZTEST_ADLS_KEY)\"", >> $cnfFile
|
2022-06-28 05:41:37 +03:00
|
|
|
echo "\"file-key\"": "\"$(AZTEST_FILE_KEY)\"", >> $cnfFile
|
2022-02-09 19:42:28 +03:00
|
|
|
echo "\"block-sas\"": "\"$(AZTEST_BLOCK_SAS)\"", >> $cnfFile
|
2022-08-09 22:52:31 +03:00
|
|
|
echo "\"adls-sas\"": "\"$(adlsSas)\"", >> $cnfFile
|
2022-06-28 05:41:37 +03:00
|
|
|
echo "\"file-sas\"": "\"$(AZTEST_FILE_SAS)\"", >> $cnfFile
|
2022-08-02 23:50:00 +03:00
|
|
|
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
|
2022-02-09 19:42:28 +03:00
|
|
|
echo "\"msi-appid\"": "\"$(AZTEST_APP_ID)\"", >> $cnfFile
|
|
|
|
echo "\"msi-resid\"": "\"$(AZTEST_RES_ID)\"", >> $cnfFile
|
2022-10-13 20:04:08 +03:00
|
|
|
echo "\"msi-objid\"": "\"$(AZTEST_OBJ_ID)\"", >> $cnfFile
|
2022-02-09 19:42:28 +03:00
|
|
|
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: ./
|
|
|
|
|
2022-07-28 07:39:41 +03:00
|
|
|
# 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
|
2022-08-18 19:00:13 +03:00
|
|
|
$(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
|
2022-07-28 07:39:41 +03:00
|
|
|
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: ./
|
|
|
|
|
2022-02-09 19:42:28 +03:00
|
|
|
# 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
|
2022-09-15 05:48:46 +03:00
|
|
|
|
|
|
|
- task: ComponentGovernanceComponentDetection@0
|
|
|
|
inputs:
|
|
|
|
scanType: 'Register'
|
|
|
|
verbosity: 'Verbose'
|
|
|
|
alertWarningLevel: 'High'
|
|
|
|
displayName: "Component governance"
|
|
|
|
condition: always()
|