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

Docker Backend: fully support windows container #4381

Conversation

6543
Copy link
Member

@6543 6543 commented Nov 15, 2024

close #4286
address one bug described in #4274

TODO: actuall testing of:

  • normal steps
  • services
  • plugins

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 90.32258% with 3 lines in your changes missing coverage. Please review.

Project coverage is 27.64%. Comparing base (ebf9f9c) to head (1854ac5).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pipeline/backend/docker/convert_win.go 88.88% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4381      +/-   ##
==========================================
+ Coverage   27.57%   27.64%   +0.06%     
==========================================
  Files         381      382       +1     
  Lines       27923    27952      +29     
==========================================
+ Hits         7700     7726      +26     
- Misses      19538    19540       +2     
- Partials      685      686       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@6543 6543 added feature add new functionality backend/docker labels Nov 15, 2024
@6543
Copy link
Member Author

6543 commented Nov 19, 2024

image

 ./dist/woodpecker-agent.exe --backend-engine docker --backend-docker-host "npipe:////./pipe/docker_engine"

@6543
Copy link
Member Author

6543 commented Nov 19, 2024

image

look's like it works :)

the only thing is i had to modify the clone plugin:

--- a/plugins/plugin-git/Dockerfile.Windows
+++ b/plugins/plugin-git/Dockerfile.Windows
@@ -1,7 +1,7 @@
 # syntax = docker/dockerfile:1
 # escape=`

-FROM mcr.microsoft.com/windows/servercore:ltsc2022
+FROM mcr.microsoft.com/windows/servercore:1809

 # Busybox Unicode https://github.com/rmyorston/busybox-w32

@6543
Copy link
Member Author

6543 commented Nov 19, 2024

so yes woodpecker itselve wont support windows container fully ...
... mostly depending on:

@6543
Copy link
Member Author

6543 commented Nov 19, 2024

PS: I still have no idea why some things work and some are incompatible :/

image

@6543 6543 requested a review from a team November 19, 2024 21:29
@6543
Copy link
Member Author

6543 commented Nov 19, 2024

my test config:
.woodpecker/check.yaml:

labels:
  backend: docker
  platform: windows/amd64

skip_clone: true

depends_on:
    - echo

steps:
    check_echo:
        image: mcr.microsoft.com/windows/servercore:1809
        commands:
            - echo some checks
            - sleep 2s

.woodpecker/echo.yaml:

labels:
  backend: docker
  platform: windows/amd64

when:
  - event: pull_request
  - event: [push, deployment]
    branch:
      - ${CI_REPO_DEFAULT_BRANCH}

clone:
  clone:
    image: woodpecker-windows-git

steps:
    createFile:
        image: mcr.microsoft.com/windows/servercore:1809
        commands:
            - echo FROM alpine:edge >> Dockerfile
            - echo RUN apk update >> Dockerfile

    echo:
        image: mcr.microsoft.com/windows/servercore:1809
        commands:
            - echo buildZ
            - sleep 10s
            - ls
    depl:
        image: bash
        commands: echo deploy
        when:
            - event: deployment
              branch: ${CI_REPO_DEFAULT_BRANCH}

@6543
Copy link
Member Author

6543 commented Nov 19, 2024

image

@6543
Copy link
Member Author

6543 commented Nov 19, 2024

@cduchenoy ☝️ ...?

@cduchenoy
Copy link
Contributor

Hi,

It's excellent!

On Windows, we must take the tag which corresponds to the kernel version

see https://hub.docker.com/r/microsoft/windows-servercore

So I think I should check :)

  • 1809 => Windows server 2016 base
  • ltsc2019 => Windows server 2019 base
  • ltsc2022 => Windows server 2022 base
  • ltsc2025 => Windows server 2025 base

did you also test the agent build?

https://github.com/GECO-IT/woodpecker-windows/blob/main/agent/backend-docker/Dockerfile.Windows

@cduchenoy
Copy link
Contributor

For test a service image, you can use as a base: https://github.com/GECO-IT/woodpecker-windows/blob/main/base/windows-base/Dockerfile.base-chocolatey.Windows

Base image are in docker-hub: https://hub.docker.com/r/gecoit84/woodpecker-windows-base-chocolatey

and add:

choco install mysql

I haven't tried so I don't know if it launches the service correctly

@6543
Copy link
Member Author

6543 commented Nov 20, 2024

did you also test the agent build?

no as I only wana test if the engine works ... so the deployment of the agent should not alter the test ...

@6543
Copy link
Member Author

6543 commented Nov 20, 2024

For test a service

ah nice ... will do so

@6543
Copy link
Member Author

6543 commented Nov 20, 2024

image
image

labels:
  backend: docker
  platform: windows/amd64

skip_clone: true

steps:
    create:
        image: mcr.microsoft.com/windows/servercore:1809
        commands:
            - echo some checks > NEW
            - sleep 2s

    curl:
        image: a6543/woodpecker-windows-base-chocolatey:latest
        commands:
            - choco install -y curl
            - curl.exe -I http://caddy:80
            - curl.exe http://caddy:80/NEW

services:
    caddy:
        image: a6543/woodpecker-windows-caddy-static:latest
        ports:
            - 80

services work just fine ...

@6543 6543 added the backport-needed indicates that this pull should be packported label Nov 23, 2024
Copy link
Contributor

@pat-s pat-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no clue about windows but lgtm WRT to the diff.

@pat-s pat-s merged commit f829c07 into woodpecker-ci:main Nov 26, 2024
9 checks passed
@woodpecker-bot
Copy link
Collaborator

@6543 6543 deleted the backend/docker/non-conf-windows-container-support branch November 26, 2024 10:49
@woodpecker-bot woodpecker-bot mentioned this pull request Nov 26, 2024
1 task
@6543
Copy link
Member Author

6543 commented Nov 26, 2024

-> #4464

@6543 6543 added backport-done indicates that this pull has been backported and removed backport-needed indicates that this pull should be packported labels Nov 26, 2024
@woodpecker-bot woodpecker-bot mentioned this pull request Nov 26, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend/docker backport-done indicates that this pull has been backported feature add new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants