woodpecker-ci / woodpecker

Woodpecker is a simple, yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
4.3k stars 371 forks source link

Docker Windows Agent #4274

Open cduchenoy opened 3 weeks ago

cduchenoy commented 3 weeks ago

Component

agent

Describe the bug

From version > 2.6.1 bind mount workspace failed

Steps to reproduce

  1. install woodpecker docker agent (windows) > 2.6.0
  2. run an ci

Expected behavior

No response

System Info

{
source: "https://github.com/woodpecker-ci/woodpecker",
version: "2.6.0"
}

Additional context

First of all: Thank you very much for this useful tool!

For a client we ported the containers (agent, plugin-git) and added one base-step (with chocolatey installed) to Microsoft Windows.

For more information, see https://github.com/GECO-IT/woodpecker-windows

We encounter 2 problems:

1 From agent version > 2.6.0, we have a problem mounting volumes in plugins.

Before this release, we could work around the docker error by adding

---
...
workspace:
  base: C:\tmp
..

We believe this error comes from PR #3933.

2 With the trustedClonePlugins variable https://github.com/woodpecker-ci/woodpecker/blob/main/shared/constant/constant.go

We need to retag our local plugin-git image: “woodpeckerci/plugin-git” to keep netrc secure!

Do you think you could include Windows images officially?

For information: we have also include an installer for local backend on Windows.

Best regards Cyril DUCHENOY Geco-iT

Validations

6543 commented 3 weeks ago

this most likely has to do with https://github.com/woodpecker-ci/woodpecker/pull/3933 witch was done because of https://github.com/woodpecker-ci/woodpecker/issues/3924

cduchenoy commented 3 weeks ago

Yes you right, perhaps we can add "C:\" as a prefix to the bind mount if the agent is of the windows/xxx type?

6543 commented 3 weeks ago

I would say if workflow workspace has C:\ prefix we do add it there too ...

... feel free to create a pull

6543 commented 3 weeks ago

Hmm also if labels platform has windows ... but in any case this is an heuristic and should be an own function

checkRunOnWindowsHeuristics(...) bool witch will then add the prefix on true

-> there is no 100% pervect solution :/

6543 commented 3 weeks ago

Do you think you could include Windows images officially?

Do you have an source of your windows git clone plugin ... it's an open issue for our plugin ...

cduchenoy commented 3 weeks ago

Yes in the same repo https://github.com/GECO-IT/woodpecker-windows/tree/main/plugins/plugin-git

cduchenoy commented 3 weeks ago

We just dockerize the official plugin under windows

cduchenoy commented 3 weeks ago

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

qwerty287 commented 2 weeks ago

@cduchenoy can you open PRs in the corresponding repos? Thanks for your work!

6543 commented 2 weeks ago

the biggest problem we currently have is: no agent running on windows with docker+windows backend ...

... so we might have a look if we can autoscale windows vms on demand via https://github.com/woodpecker-ci/autoscaler

6543 commented 2 weeks ago

-> https://github.com/woodpecker-ci/autoscaler/issues/133 to only deploy agent with windows if needed based on lable -> ms azure support on the autoscaler

another option would be if somebody sponsor an agent that run all the time ... but i would call that an hotfix

cduchenoy commented 4 days ago

Hi,

I updated our repository https://github.com/GECO-IT/woodpecker-windows

As expected, I submitted our teams-notify plugin :)

I would also like to prepare the expected PRs but I don't really know what to send...

I just uploaded the docker file for the agent and plugin?