windmill-labs / windmill-sync-example

29 stars 9 forks source link

GitLab support #8

Open almereyda opened 1 year ago

almereyda commented 1 year ago

The documentation page at

suggests Windmill could integrate with GitLab.

How would an adapted .gitlab-ci.yaml file look like?

rubenfiszel commented 1 year ago

@almereyda I don't know gitlab-ci but I assume it would be really easy to setup: Push on merge, see: https://github.com/windmill-labs/windmill-sync-example/blob/main/.github/workflows/push-on-merge.yaml Pull regularly, see: https://github.com/windmill-labs/windmill-sync-example/blob/main/.github/workflows/pull-workspace.yaml

Most of it is running the deno cli directly:

          deno run --unstable -A  https://deno.land/x/wmill@v1.104.0/main.ts workspace add __automation ${{ env.WMILL_WORKSPACE }} ${{ env.WMILL_URL }} --token ${{ secrets.WMILL_TOKEN }}
          deno run --unstable -A  https://deno.land/x/wmill@v1.104.0/main.ts sync push --yes --fail-conflicts

The first command link a workspace to the ephemeral env using the remote informations The second just run wmill sync push --yes --fail-conflicts

I would assume it's possible to run deno in gitlab and that's the only thing necessary.

almereyda commented 1 year ago

This sounds marvellous. I would like to give it a try within the next few weeks, and report back here.

rubenfiszel commented 1 year ago

When you figure it out, if you can share your .gitlab-ci.yaml, we would be grateful for it.

antonionicampos commented 1 year ago

@almereyda Did you manage to advance at this point? There are other people interested in this integration with GitLab.

@rubenfiszel It would even be very interesting for the dissemination of the tool as a whole. I work at a big company that only uses GitLab.

Thank you in advance.

almereyda commented 1 year ago

I'm not actively working on this right now.

rubenfiszel commented 1 year ago

@antonionicampos if you're evaluating using windmill in an enterprise setting, we would be happy to prioritize this for a PoC. Just book a slot with me: www.windmill.dev/ruben-30min

ghost commented 4 months ago

It would be nice to have a command like wmill sync diff --push|--pull that only returns the diff, which can then be compared against a Git diff inside a merge request, so we can make sure that Git changes represent actual changes or spot discrepancies (e.g. someone messed with it online) before execution.

The super simple pipeline step we are using at the moment is this:

variables:
  WMILL_VERSION: "v1.349.1"
  WMILL_USER: "gitlab-ci"
  WMILL_WORKSPACE_ID: "..."
  WMILL_WORKSPACE_NAME: "..."

windmill-sync:
  stage: sync
  image:
    name: denoland/deno:debian
    entrypoint: ["/usr/bin/bash"]
  script: |
    set -e

    deno run --unstable -A "https://deno.land/x/wmill@${WMILL_VERSION}/main.ts" \
        --token "${WMILL_TOKEN}" \
        workspace add \
          --create \
          --create-workspace-name "${WMILL_WORKSPACE_NAME}" \
          --create-username "${WMILL_USER}" \
          "${WMILL_WORKSPACE_NAME}" \
          "${WMILL_WORKSPACE_ID}" \
          "${WMILL_URL}"

    deno run --unstable -A "https://deno.land/x/wmill@${WMILL_VERSION}/main.ts" \
        --token "${WMILL_TOKEN}" \
        sync push \
          --yes \
          --fail-conflicts

Variables WMILL_URL and WMILL_TOKEN are configured as CI variables.

Once we get windmill-labs/windmill#3943 this will be even simpler and much faster in execution (as long as the actual Docker image is going to be relatively small), since then we don't need to download windmill and all its dependencies each time.

rubenfiszel commented 4 months ago

windmill cli available at: https://github.com/windmill-labs/windmill/pkgs/container/windmill-cli (image itself at: ghcr.io/windmill-labs/windmill-cli)