docker/azure-pipelines.yml

90 lines
2.2 KiB
YAML

# https://dev.azure.com/home-assistant
trigger:
batch: true
branches:
include:
- master
tags:
include:
- '*'
pr:
- master
variables:
- name: versionHadolint
value: 'v1.17.2'
- name: versionShellCheck
value: 'v0.7.0'
- name: versionBuilder
value: '7.1'
- group: docker
jobs:
- job: 'Hadolint'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: sudo docker pull hadolint/hadolint:$(versionHadolint)
displayName: 'Install Hadolint'
- script: |
set -e
shopt -s globstar
for dockerfile in **/Dockerfile
do
echo "Linting: $dockerfile"
sudo docker run --rm -i \
-v $(pwd)/.hadolint.yaml:/.hadolint.yaml:ro \
hadolint/hadolint:$(versionHadolint) < "$dockerfile"
done
displayName: 'Run Hadolint'
- job: 'ShellCheck'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: sudo docker pull koalaman/shellcheck:$(versionShellCheck)
displayName: 'Install ShellCheck'
- script: |
shopt -s globstar
sudo docker run --rm -i \
-v $(pwd):/mnt:ro koalaman/shellcheck:$(versionShellCheck) -s bash **/*.sh
displayName: 'Run ShellCheck'
- job: 'HomeAssistant_Base'
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags'), succeeded('Hadolint'), succeeded('ShellCheck'))
dependsOn:
- 'Hadolint'
- 'ShellCheck'
timeoutInMinutes: 360
pool:
vmImage: 'ubuntu-latest'
strategy:
maxParallel: 3
matrix:
amd64:
buildArch: 'amd64'
i386:
buildArch: 'i386'
armhf:
buildArch: 'armhf'
armv7:
buildArch: 'armv7'
aarch64:
buildArch: 'aarch64'
steps:
- script: sudo docker login -u $(dockerUser) -p $(dockerPassword)
displayName: 'Docker hub login'
- script: sudo docker pull homeassistant/amd64-builder:$(versionBuilder)
displayName: 'Install Builder'
- script: |
sudo docker run --rm --privileged \
-v ~/.docker:/root/.docker \
-v /run/docker.sock:/run/docker.sock:rw -v $(pwd):/data:ro \
homeassistant/amd64-builder:$(versionBuilder) \
--generic $(Build.SourceBranchName) "--$(buildArch)" -t /data
displayName: 'Build Home Assistant Base'