audit-go/.azuredevops/build-pipeline.yml
Christian Schaible 7623ffc225 Merged PR 678247: fix: Adjust SequenceNumberGenerator to revert specific sequence numbers
Concurrent invocations on the SequenceNumberGenerator can lead to gaps and duplicate sequence numbers. To fix the issue an internal "backlog" is added as a buffer. If a new number is requested the "backlog" is checked first before creating a new number.

The "host" HTTP-Header is filtered out hide internal information.

The following build dependencies have been updated:
- Go has been updated to version 1.23.3.
- Golanglint-ci has been updated to version v1.62.0.
- Buf has been updated to version v1.46.0

The following library dependencies have been updated:
- go.opentelemetry.io/otel has been updated to version v1.32.0
- go.opentelemetry.io/otel/trace has been updated to version v1.32.0

Related work items: #696569
2024-11-12 14:29:20 +00:00

117 lines
3.8 KiB
YAML

pool:
vmImage: 'ubuntu-latest'
variables:
- name: bufVersion
value: v1.46.0
- name: golangCiLintVersion
value: v1.62.0
- name: goVersion
value: 1.23.3
- name: protobufValidateVersion
value: v1.1.0
- name: protobufVersion
value: v1.35.1
- name: GOPATH
value: '$(system.defaultWorkingDirectory)/gopath'
stages:
- stage: Build
jobs:
- job: GoBuildTest
displayName: Run build and tests
variables:
- name: isCiBuild
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
steps:
- task: GoTool@0
displayName: Install Go $(goVersion)
inputs:
version: $(goVersion)
- bash: |
set -e
go env -w GOMODCACHE="$(pwd)/.gomodcache"
displayName: Configure GOMODCACHE
- bash: |
set -e
go install google.golang.org/protobuf/cmd/protoc-gen-go@$(protobufVersion)
go install github.com/envoyproxy/protoc-gen-validate@$(protobufValidateVersion)
go install github.com/bufbuild/buf/cmd/buf@$(bufVersion)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $(golangCiLintVersion)
condition: succeeded()
displayName: Install build dependencies
- bash: |
set -e
echo on
go mod download
go mod tidy
go get ./...
condition: succeeded()
displayName: Download dependencies
- bash: |
set -e
echo on
rm -rf gen/
export PATH="$PATH:$GOPATH/bin"
buf format proto -w
cd proto
buf lint
buf generate
cd -
condition: succeeded()
displayName: Regenerate code from schema
- bash: |
set -e
echo on
export PATH="$PATH:$GOPATH/bin"
go fmt ./... && go vet ./... && golangci-lint run
condition: succeeded()
displayName: Format and lint
- bash: |
set -e
echo on
git diff HEAD --name-only --exit-code
condition: succeeded()
displayName: Check local changes after code generation and formatting
- bash: go build ./...
condition: succeeded()
displayName: Build
- bash: go test ./...
condition: succeeded()
displayName: Run tests
- task: SnykSecurityScan@1
condition: and(succeeded(), eq(variables.isCiBuild, true))
displayName: Snyk check (main branch)
inputs:
additionalArguments: "--remote-repo-url=$(Build.Repository.Uri)"
failOnIssues: false
monitorWhen: 'always'
organization: 'xx-sit-odj-stackit-public'
projectName: $(Build.Repository.Name)
serviceConnectionEndpoint: 'xx-sit-odj-stackit-public-snyk'
testType: 'app'
- task: SnykSecurityScan@1
condition: and(succeeded(), eq(variables.isCiBuild, false))
displayName: Snyk check
inputs:
additionalArguments: "--remote-repo-url=$(Build.Repository.Uri)"
failOnIssues: false
monitorWhen: 'never'
organization: 'xx-sit-odj-stackit-public'
projectName: $(Build.Repository.Name)
serviceConnectionEndpoint: 'xx-sit-odj-stackit-public-snyk'
testType: 'app'
- bash: sudo rm -rf .gomodcache
condition: always()
displayName: Clean up the local cache (.gomodcache)