ci: use meson 1.1.1 in the 1.22 branch Windows CI
[platform/upstream/gstreamer.git] / ci / docker / windows / container.ps1
1 # Copied from mesa, big kudos
2 #
3 # https://gitlab.freedesktop.org/mesa/mesa/-/blob/master/.gitlab-ci/windows/mesa_container.ps1
4 # https://gitlab.freedesktop.org/mesa/mesa/-/blob/34e3e164936d1d3cef267da7780e87f062fedf39/.gitlab-ci/windows/mesa_container.ps1
5
6 # Implements the equivalent of ci-templates container-ifnot-exists, using
7 # Docker directly as we don't have buildah/podman/skopeo available under
8 # Windows, nor can we execute Docker-in-Docker
9 $registry_uri = $args[0]
10 $registry_username = $args[1]
11 $registry_password = $args[2]
12 $registry_user_image = $args[3]
13 $registry_central_image = $args[4]
14 $dockerfile = $args[5]
15
16 docker --config "windows-docker.conf" login -u "$registry_username" -p "$registry_password" "$registry_uri"
17 if (!$?) {
18   Write-Host "docker login failed to $registry_uri"
19   Exit 1
20 }
21
22 # if the image already exists, don't rebuild it
23 docker --config "windows-docker.conf" pull "$registry_user_image"
24 if ($?) {
25   Write-Host "User image $registry_user_image already exists; not rebuilding"
26   docker --config "windows-docker.conf" logout "$registry_uri"
27   Exit 0
28 }
29
30 # if the image already exists upstream, copy it
31 docker --config "windows-docker.conf" pull "$registry_central_image"
32 if ($?) {
33   Write-Host "Copying central image $registry_central_image to user image $registry_user_image"
34   docker --config "windows-docker.conf" tag "$registry_central_image" "$registry_user_image"
35   docker --config "windows-docker.conf" push "$registry_user_image"
36   $pushstatus = $?
37   docker --config "windows-docker.conf" logout "$registry_uri"
38   if (!$pushstatus) {
39     Write-Host "Pushing image to $registry_user_image failed"
40     Exit 1
41   }
42   Exit 0
43 }
44
45 Write-Host "No image found at $registry_user_image or $registry_central_image; rebuilding"
46 docker --config "windows-docker.conf" build $DOCKER_BUILD_ARGS --no-cache -t "$registry_user_image" -f "$dockerfile" "./ci/docker/windows"
47 if (!$?) {
48   Write-Host "Container build failed"
49   docker --config "windows-docker.conf" logout "$registry_uri"
50   Exit 1
51 }
52 Get-Date
53
54 docker --config "windows-docker.conf" push "$registry_user_image"
55 $pushstatus = $?
56 docker --config "windows-docker.conf" logout "$registry_uri"
57 if (!$pushstatus) {
58   Write-Host "Pushing image to $registry_user_image failed"
59   Exit 1
60 }