Skip to content

Commit

Permalink
Merge pull request rust-lang#10 from ecstatic-morse/azure-pipelines
Browse files Browse the repository at this point in the history
Use Azure Pipelines for Windows instead of AppVeyor
  • Loading branch information
pietroalbini authored Jul 21, 2019
2 parents fe1bd41 + a0bcddb commit b64a86f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 36 deletions.
22 changes: 0 additions & 22 deletions appveyor.yml

This file was deleted.

21 changes: 21 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
variables:
- group: docker-creds

jobs:
- job: Windows
pool:
vmImage: win1803
variables:
IMAGE_NAME: 'crates-build-env-windows'
steps:
- pwsh: ./windows/ci/build.ps1
displayName: Build Docker image
- pwsh: ./windows/ci/publish.ps1
displayName: Publish image to Docker Hub
condition: |
and(succeeded(),
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
ne(variables['Build.Reason'], 'PullRequest'))
env:
DOCKER_PASSWORD: $(DOCKER_PASSWORD)
DOCKER_USERNAME: $(DOCKER_USERNAME)
6 changes: 2 additions & 4 deletions windows/ci/build.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
$ErrorActionPreference = "Stop"

$ContainerBase = '@sha256:c06b4bfaf634215ea194e6005450740f3a230b27c510cf8facab1e9c678f3a99'
$ContainerBase = ':1803'

docker build `
-t "$env:PUSH_IMAGE" `
-t "$env:IMAGE_NAME" `
--build-arg "BASE_IMAGE_VER=$ContainerBase" `
windows
14 changes: 4 additions & 10 deletions windows/ci/publish.ps1
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
$ErrorActionPreference = "Stop"

# Build the image
./windows/ci/build.ps1

foreach ($var in "DOCKER_USERNAME", "DOCKER_PASSWORD") {
if (-not (Test-Path "env:$var")) {
echo "Environment variable \"$var\" not set"
exit 22
}
}

# Log in to dockerhub
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Env:DOCKER_PASSWORD)).Trim() `
| docker login --username "$Env:DOCKER_USERNAME" --password-stdin

docker push "$env:PUSH_IMAGE"
Write-Host "Publishing to hub.docker.com/$env:DOCKER_USERNAME"
docker login --username "$env:DOCKER_USERNAME" --password "$env:DOCKER_PASSWORD"
docker tag "$env:IMAGE_NAME" "$env:DOCKER_USERNAME/$env:IMAGE_NAME"
docker push "$env:DOCKER_USERNAME/$env:IMAGE_NAME"

0 comments on commit b64a86f

Please sign in to comment.