Skip to content

Commit

Permalink
build - publish docker nightly after functionals (cloud-custodian#4932)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefangordon committed Oct 17, 2019
1 parent 37c4e46 commit 0fdb437
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 85 deletions.
85 changes: 0 additions & 85 deletions .azure-pipelines/azure-nightly-tests.yml

This file was deleted.

131 changes: 131 additions & 0 deletions .azure-pipelines/live-functional.yml
@@ -0,0 +1,131 @@
trigger: none

schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build
branches:
include:
- master
always: true

variables:
- group: AzureLiveTests

stages:
- stage: azure_live_functional
displayName: Azure Live Functional Tests

jobs:
- job: 'azure_nightly_test_run'
displayName: 'Azure Nightly Test Run'
timeoutInMinutes: 0
cancelTimeoutInMinutes: 0

pool:
vmImage: 'Ubuntu-16.04'

steps:
- checkout: self
fetchDepth: 1

- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
architecture: 'x64'

- script: python -m pip install --upgrade pip && pip install . && pip install -r requirements-dev.txt
displayName: "Install Dependencies"

- script: az login --service-principal -u ${AZURE_CLIENT_ID} -p ${AZURE_CLIENT_SECRET} --tenant ${AZURE_TENANT_ID} && az account set -s ${AZURE_SUBSCRIPTION_ID}
displayName: "Login to Azure"
env:
AZURE_CLIENT_ID: $(azure-client-id)
AZURE_CLIENT_SECRET: $(azure-client-secret)
AZURE_SUBSCRIPTION_ID: $(azure-subscription-id)
AZURE_TENANT_ID: $(azure-tenant-id)

# Skip some resources due to some restrictions with their provisioning using Service Principal account
# We maintain those resources in the test subscription available for the tests
- script: tools/c7n_azure/tests/templates/provision.sh --skip keyvault cost-management-export containerservice databricks
displayName: "Provision Azure Resources"
env:
AZURE_CLIENT_ID: $(azure-client-id)
AZURE_CLIENT_SECRET: $(azure-client-secret)

- script: C7N_TEST_RUN=true C7N_FUNCTIONAL=yes pytest -v -m "not skiplive" tools/c7n_azure/tests
displayName: "Run Azure tests without cassettes"

- script: tools/c7n_azure/tests/templates/cleanup.sh --skip keyvault cost-management-export containerservice databricks
displayName: "Cleanup Azure Resources"
condition: always()

- job: 'azure_nightly_functions_test'
displayName: 'Azure Functions Nightly Test'
timeoutInMinutes: 0
cancelTimeoutInMinutes: 0

pool:
vmImage: 'Ubuntu-16.04'

steps:
- checkout: self
fetchDepth: 1

- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
architecture: 'x64'

- script: python -m pip install --upgrade pip && pip install . && pip install -r requirements-dev.txt
displayName: "Install Dependencies"

- script: ./test_functions.sh
workingDirectory: tools/c7n_azure/tests/azure-functions
displayName: "Run Azure Functions Test"
env:
AZURE_CLIENT_ID: $(azure-client-id)
AZURE_CLIENT_SECRET: $(azure-client-secret)
AZURE_SUBSCRIPTION_ID: $(azure-subscription-id)
AZURE_TENANT_ID: $(azure-tenant-id)

# If all functional test stages complete successfully then
# push a docker image and tag `nightly`.
- stage: post_success
displayName: After Successful Functional Tests
dependsOn: azure_live_functional

jobs:
- job: 'push_docker_nightly'
displayName: 'Push Nightly Docker Image'

pool:
vmImage: 'Ubuntu-16.04'

steps:
- bash: |
printf -v TAG_DATE '%(%Y%m%d)T\n' -1
echo "##vso[task.setvariable variable=TAG_DATE]$TAG_DATE"
# C7N
- task: Docker@2
displayName: Build and Push C7N Nightly
inputs:
command: buildAndPush
Dockerfile: Dockerfile
containerRegistry: dockerServiceConnection
repository: cloudcustodian/c7n
tags: |
nightly
$(TAG_DATE)-nightly
# Mailer
- task: Docker@2
displayName: Build and Push Mailer Nightly
inputs:
command: buildAndPush
Dockerfile: tools/c7n_mailer/Dockerfile
containerRegistry: dockerServiceConnection
repository: cloudcustodian/mailer
tags: |
nightly
$(TAG_DATE)-nightly

0 comments on commit 0fdb437

Please sign in to comment.