Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ONPREM-1829] [HACKWEEK] Add initial support for Windows containers #96

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Start building binaries and images
  • Loading branch information
christian-stephen committed Feb 21, 2025
commit 437d725458647cf4c95ab95a356743c09501951a
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ executors:
machine:
image: windows-server-2022-gui:current
shell: bash.exe -login
resource_class: windows.xlarge
resource_class: windows.medium
ccc:
docker:
- image: circleci/command-convenience:0.1
@@ -60,7 +60,7 @@ workflows:
context: [ org-global ]
- images:
context: [ org-global, runner-image-signing ]
requires: [ lint, test, build, scan, vuln-scanner/vuln_scan ]
requires: [ lint, build, scan, vuln-scanner/vuln_scan ]
- smoke-tests:
context: [ org-global, runner-smoke-tests ]
requires: [ images ]
5 changes: 4 additions & 1 deletion .goreleaser/binaries.yaml
Original file line number Diff line number Diff line change
@@ -11,8 +11,11 @@ builds:
- -X github.com/circleci/runner-init/cmd.Version={{.Env.BUILD_VERSION}}
- -X github.com/circleci/runner-init/cmd.Date={{.Date}}
env: [CGO_ENABLED=0]
goos: [linux]
goos: [linux, windows]
goarch: [amd64, arm64]
ignore:
- goos: windows
goarch: arm64
no_unique_dist_dir: true

- id: fake-task-agent
1 change: 1 addition & 0 deletions .goreleaser/dockers.yaml
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ docker_manifests:
image_templates:
- "circleci/runner-init:agent-amd64{{.Env.IMAGE_TAG_SUFFIX}}"
- "circleci/runner-init:agent-arm64{{.Env.IMAGE_TAG_SUFFIX}}"
- "circleci/runner-init:agent-windows{{.Env.IMAGE_TAG_SUFFIX}}"
skip_push: "{{.Env.SKIP_PUSH}}"

- name_template: "circleci/runner-init:test-agent"
6 changes: 6 additions & 0 deletions do
Original file line number Diff line number Diff line change
@@ -36,9 +36,15 @@ help_images="Build and push the Docker images and manifests."
images() {
set -x

docker buildx create --name circleci-runner-init-windows-builder \
--driver=docker-container --driver-opt image=moby/buildkit:rootless || true

skip="${SKIP_PUSH:-true}"
[ "${SKIP_PUSH:-true}" = "true" ] && push_windows="false" || push_windows="true"

SKIP_PUSH="${skip}" \
SKIP_PUSH_TEST_AGENT="${SKIP_PUSH_TEST_AGENT:-${skip}}" \
PUSH_WINDOWS="${push_windows}" \
IMAGE_TAG_SUFFIX="${IMAGE_TAG_SUFFIX:-""}" \
PICARD_VERSION="${PICARD_VERSION:-agent}" \
go tool goreleaser \
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ FROM scratch AS builder

ARG TARGETPLATFORM

COPY --from=task-agent-image /opt/circleci/${TARGETPLATFORM}/circleci-agent /
COPY --from=task-agent-image /opt/circleci/${TARGETPLATFORM}/circleci-agent* /
COPY ./target/bin/${TARGETPLATFORM}/orchestrator /

FROM scratch
2 changes: 1 addition & 1 deletion docker/test.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM scratch as builder
FROM scratch AS builder

ARG TARGETPLATFORM

16 changes: 16 additions & 0 deletions docker/windows.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG PICARD_VERSION=agent

FROM --platform=${BUILDPLATFORM} circleci/picard:${PICARD_VERSION} AS task-agent-image

FROM --platform=${BUILDPLATFORM} scratch AS builder

ARG TARGETPLATFORM

COPY --from=task-agent-image /opt/circleci/${TARGETPLATFORM}/circleci-agent /circleci-agent.exe
COPY ./target/bin/${TARGETPLATFORM}/orchestrator.exe /

FROM mcr.microsoft.com/windows/nanoserver:ltsc2025

COPY --from=builder / /

ENTRYPOINT ["c:\\orchestrator.exe", "init"]