mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
add agent build
This commit is contained in:
parent
23b6378fdf
commit
ae2f76e4b7
3 changed files with 118 additions and 2 deletions
116
azure-pipelines.agent.yaml
Normal file
116
azure-pipelines.agent.yaml
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
trigger:
|
||||
batch: false
|
||||
branches:
|
||||
include: ["master"]
|
||||
paths:
|
||||
include:
|
||||
[
|
||||
"azure-pipelines.agent.yaml",
|
||||
"src/FilterLists.Agent/*",
|
||||
"tests/FilterLists.Agent.Tests/*",
|
||||
".dockerignore",
|
||||
"docker-compose.yml",
|
||||
"docker-compose.prod.yml",
|
||||
"docker-compose.agent.tests.yml",
|
||||
]
|
||||
|
||||
pr:
|
||||
autoCancel: false
|
||||
branches:
|
||||
include: ["master"]
|
||||
paths:
|
||||
include:
|
||||
[
|
||||
"azure-pipelines.agent.yaml",
|
||||
"src/FilterLists.Agent/*",
|
||||
"tests/FilterLists.Agent.Tests/*",
|
||||
".dockerignore",
|
||||
"docker-compose.yml",
|
||||
"docker-compose.prod.yml",
|
||||
"docker-compose.agent.tests.yml",
|
||||
]
|
||||
|
||||
pool:
|
||||
vmImage: "ubuntu-latest"
|
||||
|
||||
steps:
|
||||
- task: Docker@2
|
||||
displayName: "create volume test-agent-results"
|
||||
inputs:
|
||||
command: "volume"
|
||||
arguments: "create test-agent-results"
|
||||
|
||||
- task: DockerCompose@0
|
||||
displayName: "run agent"
|
||||
inputs:
|
||||
dockerComposeFile: "docker-compose.agent.tests.yml"
|
||||
dockerComposeCommand: "run agent"
|
||||
|
||||
- task: Docker@2
|
||||
displayName: "create container test-agent-results"
|
||||
inputs:
|
||||
command: "container"
|
||||
arguments: "create --name test-agent-results -v test-agent-results:/results hello-world"
|
||||
condition: "succeededOrFailed()"
|
||||
|
||||
- task: Docker@2
|
||||
displayName: "copy out test-agent results"
|
||||
inputs:
|
||||
command: "cp"
|
||||
arguments: "test-agent-results:/results $(System.DefaultWorkingDirectory)"
|
||||
condition: "succeededOrFailed()"
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: "publish test results"
|
||||
inputs:
|
||||
testResultsFormat: "VSTest"
|
||||
testResultsFiles: "**/*.trx"
|
||||
condition: "succeededOrFailed()"
|
||||
|
||||
- task: DockerCompose@0
|
||||
displayName: "build final"
|
||||
inputs:
|
||||
dockerComposeFile: "docker-compose.yml"
|
||||
additionalDockerComposeFiles: "docker-compose.prod.yml"
|
||||
dockerComposeCommand: "build agent"
|
||||
condition: "and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))"
|
||||
|
||||
- task: Docker@2
|
||||
displayName: "tag build number"
|
||||
inputs:
|
||||
containerRegistry: "collinbarrett2-dockerhub"
|
||||
repository: "collinbarrett2/filterlists.agent"
|
||||
command: "tag"
|
||||
arguments: "collinbarrett2/filterlists.agent:latest collinbarrett2/filterlists.agent:$(Build.BuildId)"
|
||||
condition: "and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))"
|
||||
|
||||
- task: Docker@2
|
||||
displayName: "push"
|
||||
inputs:
|
||||
containerRegistry: "collinbarrett2-dockerhub"
|
||||
repository: "collinbarrett2/filterlists.agent"
|
||||
command: "push"
|
||||
tags: |
|
||||
latest
|
||||
$(Build.BuildId)
|
||||
condition: "and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))"
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: "stage docker-compose files"
|
||||
inputs:
|
||||
SourceFolder: "$(Build.SourcesDirectory)"
|
||||
Contents: |
|
||||
docker-compose.yml
|
||||
docker-compose.prod.yml
|
||||
TargetFolder: "$(Build.ArtifactStagingDirectory)"
|
||||
CleanTargetFolder: true
|
||||
OverWrite: true
|
||||
condition: "and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))"
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: "publish docker-compose files"
|
||||
inputs:
|
||||
PathtoPublish: "$(Build.ArtifactStagingDirectory)"
|
||||
ArtifactName: "drop"
|
||||
publishLocation: "Container"
|
||||
condition: "and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))"
|
||||
|
|
@ -2,7 +2,7 @@ version: "3.7"
|
|||
|
||||
services:
|
||||
agent:
|
||||
image: docker.pkg.github.com/collinbarrett/filterlists/filterlists.agent:test-agent
|
||||
image: collinbarrett2/filterlists.agent:test-agent
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/FilterLists.Agent/Dockerfile
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ services:
|
|||
]
|
||||
|
||||
agent:
|
||||
image: docker.pkg.github.com/collinbarrett/filterlists/filterlists.agent:latest
|
||||
image: collinbarrett2/filterlists.agent:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/FilterLists.Agent/Dockerfile
|
||||
|
|
|
|||
Loading…
Reference in a new issue