Added build container and pipeline
This commit is contained in:
Родитель
a52d1fb0bc
Коммит
f36d5a16ea
|
@ -77,4 +77,5 @@ tags
|
|||
.history
|
||||
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
|
||||
telepresence.log
|
||||
.idea
|
||||
.idea
|
||||
main
|
|
@ -104,4 +104,8 @@ provided by the bot. You will only need to do this once across all repos using o
|
|||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
||||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||
|
||||
**Notes:
|
||||
|
||||
Profile store must assign a header for a group and that will be a unique match for rules on traffic flowing through Traefik.
|
|
@ -0,0 +1,69 @@
|
|||
resources:
|
||||
containers:
|
||||
- container: golang1.12
|
||||
image: devcrewsacr.azurecr.io/operator-sdk-builder:latest
|
||||
endpoint: devcrewsacr
|
||||
options: '-v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock'
|
||||
|
||||
trigger:
|
||||
paths:
|
||||
exclude:
|
||||
- assets/*
|
||||
- deploy/*
|
||||
|
||||
name: $(Date:yyyyMMdd)$(Rev:r)
|
||||
variables:
|
||||
OperatorImage: devcrewsacr.azurecr.io/public/k8s/bedrock/ring-operator
|
||||
MyBuildId: $(Date:yyyyMMdd)$(Rev:r)
|
||||
Author: $(Build.RequestedForEmail)
|
||||
BranchName: $(Build.SourceBranchName)
|
||||
|
||||
jobs:
|
||||
######################################################################
|
||||
# Build
|
||||
######################################################################
|
||||
- job: Build
|
||||
container: golang1.12
|
||||
displayName: Build Operator
|
||||
steps:
|
||||
- task: CacheBeta@0
|
||||
inputs:
|
||||
key: $(Agent.OS)
|
||||
path: $(Pipeline.Workspace)/vendor
|
||||
displayName: 'Cache yarn'
|
||||
|
||||
- script: go build cmd/manager/main.go
|
||||
|
||||
######################################################################
|
||||
# Tests
|
||||
######################################################################
|
||||
- job: UnitTests
|
||||
container: golang1.12
|
||||
displayName: Run unit tests
|
||||
dependsOn: Build
|
||||
steps:
|
||||
- script: go test -cover $(go list ./... | grep -v /vendor/)
|
||||
|
||||
######################################################################
|
||||
# Container Creation
|
||||
######################################################################
|
||||
- job: Containerize
|
||||
displayName: Build and push container
|
||||
dependsOn: UnitTests
|
||||
steps:
|
||||
- script: |
|
||||
set -ex
|
||||
sudo groupadd -o -g $(stat --format='%g' /var/run/docker.sock) docker
|
||||
sudo usermod -a -G docker $(whoami)
|
||||
displayName: Allow current user to access the docker socket
|
||||
|
||||
- task: Docker@2
|
||||
displayName: Login to Azure Container Registry
|
||||
inputs:
|
||||
command: login
|
||||
containerRegistry: $(AzureCRName)
|
||||
|
||||
- script: operator-sdk build $(OperatorPath):$()
|
||||
- script: |
|
||||
docker push $(OperatorPath):$(MyBuildId)
|
||||
docker push $(OperatorPath):latest
|
|
@ -0,0 +1,8 @@
|
|||
FROM golang:1.12.7-alpine3.10
|
||||
|
||||
RUN apk add git
|
||||
|
||||
ENV RELEASE_VERSION v0.9.0
|
||||
|
||||
RUN wget -O /usr/local/bin/operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && \
|
||||
chmod +x /usr/local/bin/operator-sdk
|
Загрузка…
Ссылка в новой задаче