Revert "Revert "docker/windows: build rust image in the ci""

This reverts commit 3f17e16c72.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-ci/-/merge_requests/414>
This commit is contained in:
Jordan Petridis 2021-09-08 15:14:57 +03:00
parent 6da650c12f
commit 83e9552bf0
4 changed files with 54 additions and 24 deletions

View file

@ -1,7 +1,7 @@
$env:ErrorActionPreference='Stop'
$env:DEFAULT_BRANCH='master'
$env:VERSION='v18'
$env:VERSION='test'
$env:tag ="registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:$env:VERSION-$env:DEFAULT_BRANCH"
$env:rust_tag ="registry.freedesktop.org/gstreamer/gst-ci/amd64/windows-rust:$env:VERSION-$env:DEFAULT_BRANCH"
@ -23,22 +23,5 @@ if (!$?) {
Exit 1
}
# Get-Date
# Write-Output "Pushing $env:tag"
# docker push $env:tag
# if (!$?) {
# Write-Host "Failed to push docker image $env:tag"
# Exit 1
# }
# Get-Date
# Write-Output "Pushing $env:rust_tag"
# docker push $env:rust_tag
# if (!$?) {
# Write-Host "Failed to push docker image $env:rust_tag"
# Exit 1
# }
Get-Date
Write-Output "Build Finished"

View file

@ -13,8 +13,6 @@ $registry_user_image = $args[3]
$registry_central_image = $args[4]
$dockerfile = $args[5]
Set-Location -Path ".\docker\windows"
docker --config "windows-docker.conf" login -u "$registry_username" -p "$registry_password" "$registry_uri"
if (!$?) {
Write-Host "docker login failed to $registry_uri"
@ -45,7 +43,7 @@ if ($?) {
}
Write-Host "No image found at $registry_user_image or $registry_central_image; rebuilding"
docker --config "windows-docker.conf" build --no-cache -t "$registry_user_image" -f "$dockerfile" .
docker --config "windows-docker.conf" build $DOCKER_BUILD_ARGS --no-cache -t "$registry_user_image" -f "$dockerfile" "./docker/windows"
if (!$?) {
Write-Host "Container build failed"
docker --config "windows-docker.conf" logout "$registry_uri"

View file

@ -1,6 +1,9 @@
# escape=`
FROM 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v16-master'
# Expect this to be set when calling docker build with
# --build-arg BASE_IMAGE="" and make it fail if not set.
ARG BASE_IMAGE="inavlid.gstreamer.freedesktop.org/invalid"
FROM $BASE_IMAGE
ARG DEFAULT_BRANCH="master"
ARG RUST_VERSION="1.52.1"

View file

@ -3,6 +3,7 @@ include:
stages:
- 'build docker'
- 'build docker stage 2'
- 'preparation'
- 'pre-build'
- 'build'
@ -38,6 +39,7 @@ variables:
TEST_MANIFEST_AMD64_SUFFIX: 'amd64/test-manifest'
INDENT_AMD64_SUFFIX: 'amd64/gst-indent'
WINDOWS_AMD64_SUFFIX: 'amd64/windows'
WINDOWS_RUST_AMD64_SUFFIX: 'amd64/windows-rust'
FEDORA_IMAGE: "$CI_REGISTRY_IMAGE/$FEDORA_AMD64_SUFFIX:$FEDORA_TAG-$GST_UPSTREAM_BRANCH"
FEDORA_DOCS_IMAGE: "registry.freedesktop.org/gstreamer/gst-ci/amd64/fedora:2020-07-03.0-master"
@ -48,6 +50,8 @@ variables:
INDENT_IMAGE: "$CI_REGISTRY_IMAGE/$INDENT_AMD64_SUFFIX:$INDENT_TAG-$GST_UPSTREAM_BRANCH"
WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$GST_UPSTREAM_REPO/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
WINDOWS_RUST_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_RUST_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
WINDOWS_RUST_UPSTREAM_IMAGE: "$CI_REGISTRY/$GST_UPSTREAM_REPO/$WINDOWS_RUST_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
# Current windows image doesn't seem to be able to spawn procceses for reason,
# use a different image until this is debuged
@ -57,7 +61,9 @@ variables:
# Can't use $CI_* variables since we use this template in all repos, not just gst-ci
CERBERO_SCRIPT_URL: "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/${GST_UPSTREAM_BRANCH}/gitlab/cerbero_setup.sh"
WINDOWS_CONTAINER_SCRIPT_URL: "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/${GST_UPSTREAM_BRANCH}/docker/windows/container.ps1"
# FIXME: fix the file path url to point to the upstram once merged
# WINDOWS_CONTAINER_SCRIPT_URL: "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/${GST_UPSTREAM_BRANCH}/docker/windows/container.ps1"
WINDOWS_CONTAINER_SCRIPT_URL: "https://gitlab.freedesktop.org/alatiera/gst-ci/raw/alatiera/windows-rs-wip/docker/windows/container.ps1"
GIT_STRATEGY: none
MESON_BUILDTYPE_ARGS: --default-library=both
@ -349,12 +355,15 @@ windows amd64 docker:
#
# We also don't need a CONTEXT_DIR var as its also
# hardcoded to be docker/windows/
DOCKERFILE: "Dockerfile"
DOCKERFILE: "docker/windows/Dockerfile"
tags:
- windows
- shell
- "1809"
script:
# We need to pass an array and to resolve the env vars, so we can't use a variable:
- $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH")
- $env:WINDOWS_CONTAINER_SCRIPT_PATH = "$env:CI_PROJECT_DIR\container.ps1"
- echo "Fetching $env:WINDOWS_CONTAINER_SCRIPT_URL"
- Invoke-WebRequest -Uri $env:WINDOWS_CONTAINER_SCRIPT_URL -OutFile $env:WINDOWS_CONTAINER_SCRIPT_PATH
@ -366,6 +375,43 @@ windows amd64 docker:
Exit 1
}
windows rust amd64 docker:
stage: 'build docker stage 2'
needs:
- job: 'windows amd64 docker'
artifacts: false
variables:
GIT_STRATEGY: 'fetch'
REPO_SUFFIX: "$WINDOWS_RUST_AMD64_SUFFIX"
TAG: "$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
# Unlike the buildah/linux jobs, this file
# needs to be relative to docker/windows/ subdir
# as it makes life easier in the powershell script
#
# We also don't need a CONTEXT_DIR var as its also
# hardcoded to be docker/windows/
DOCKERFILE: 'docker/windows/rust.Dockerfile'
tags:
- 'windows'
- 'shell'
- '1809'
script:
# We need to pass an array and to resolve the env vars, so we can't use a variable:
- $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH", "--build-arg", "BASE_IMAGE=$WINDOWS_IMAGE")
- $env:WINDOWS_CONTAINER_SCRIPT_PATH = "$env:CI_PROJECT_DIR\container.ps1"
- echo "Fetching $env:WINDOWS_CONTAINER_SCRIPT_URL"
- Invoke-WebRequest -Uri $env:WINDOWS_CONTAINER_SCRIPT_URL -OutFile $env:WINDOWS_CONTAINER_SCRIPT_PATH
- "& $env:WINDOWS_CONTAINER_SCRIPT_PATH $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $WINDOWS_RUST_IMAGE $WINDOWS_RUST_UPSTREAM_IMAGE $DOCKERFILE"
- |
if (!($?)) {
echo "Failed to build the image"
Exit 1
}
#
# Job to create the manifest.xml to used for our builds
#