Skip to content

Windmill integration #993

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

Merged
merged 19 commits into from
Jul 15, 2025
Merged

Windmill integration #993

merged 19 commits into from
Jul 15, 2025

Conversation

adelowo
Copy link
Member

@adelowo adelowo commented Jul 14, 2025

  • Create jobs in windmill. These are regular code/scripts that will be wrapped into Windmill compatible layer
  • Created a tiny windmill client/sdk
  • create scheduled job in windmill when a control is added to a job
  • add support for both on success and failure scripts which would be appended to scheduled jobs - globally applied
entConfig:

  windmill:
    enabled: true
    baseURL: "http://localhost"
    workspace: "test"
    token: "xyz"
    defaultTimeout: "30s"
    onFailureScript: "u/admin/glimmering_script"
    onSuccessScript: "u/admin/glimmering_script"

mutation($input: CreateScheduledJobInput!) {
  createScheduledJob(input: $input) {
    scheduledJob {
      id
    }
  }
}

{
  "input": {
    "cron": "0 22 * * 1-5",
    "downloadURL": "https://gist.githubusercontent.com/",
    "title": "SSL scanning test",
  },
}

@adelowo adelowo marked this pull request as ready for review July 14, 2025 18:03
@adelowo adelowo requested a review from a team as a code owner July 14, 2025 18:03
Comment on lines 50 to 56
if mutation.Op() == ent.OpCreate {
if err := createWindmillFlow(ctx, mutation); err != nil {
return nil, fmt.Errorf("failed to create windmill flow: %w", err)
}
}

return next.Mutate(ctx, mutation)
Copy link
Member

@golanglemonade golanglemonade Jul 14, 2025

Choose a reason for hiding this comment

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

I think this should happen after the next.Mutate, so we can make sure the validation happens correctly and then the flow is created in windmill

Suggested change
if mutation.Op() == ent.OpCreate {
if err := createWindmillFlow(ctx, mutation); err != nil {
return nil, fmt.Errorf("failed to create windmill flow: %w", err)
}
}
return next.Mutate(ctx, mutation)
retVal, err := next.Mutate(ctx, mutation)
if err != nil {
return err
}
if mutation.Op() == ent.OpCreate {
if err := createWindmillFlow(ctx, mutation); err != nil {
return nil, fmt.Errorf("failed to create windmill flow: %w", err)
}
}
return retVal, err

Copy link
Member

Choose a reason for hiding this comment

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

How does this work if a user updates the job?

Copy link
Member Author

Choose a reason for hiding this comment

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

for this, I do not want to make fields like the windmill path optional - as they aren't. the job creation also does all possible validation asides the context.

let me know if to move still

Copy link
Member

Choose a reason for hiding this comment

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

gotcha, that makes sense - but we would still need to be able to roll this back if the transaction fails so we don't end up with a hanging flow if something causes the db transaction to fail

@theopenlane-bender
Copy link

🔧 Configuration Changes Detected

This PR contains changes that will affect the Helm chart configuration. A draft infrastructure PR has been automatically created to preview these changes:

📋 Draft PR: theopenlane/openlane-infra#100

Changes Preview:


- 🔄 Merged Helm values.yaml
- 🆕 Created External Secrets templates
- ✨ Created ConfigMap template

The infrastructure PR will automatically convert from draft to ready for review once this core PR is merged.

@theopenlane-bender
Copy link

🔧 Configuration Changes Detected

This PR contains changes that will affect the Helm chart configuration. A draft infrastructure PR has been automatically created to preview these changes:

📋 Draft PR: theopenlane/openlane-infra#100

Changes Preview:

🔧 Applying Helm configuration changes...

- 🔄 Merged Helm values.yaml🔄 Merging Helm values.yaml
🔀 Merging with existing chart values...
📋 Replacing core section...
🔐 Merging external secrets configuration...
📊 Analyzing changes...

• External secrets configuration updated

The infrastructure PR will automatically convert from draft to ready for review once this core PR is merged.

@theopenlane-bender
Copy link

🔧 Configuration Changes Detected

This PR contains changes that will affect the Helm chart configuration. A draft infrastructure PR has been automatically created to preview these changes:

📋 Draft PR: theopenlane/openlane-infra#111

Changes Preview:

🔧 Applying Helm configuration changes...
Updating ConfigMap template
✅ Updated ConfigMap template

- ✅ Updated ConfigMap template

The infrastructure PR will automatically convert from draft to ready for review once this core PR is merged.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 20%)
5.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@golanglemonade golanglemonade merged commit 6926507 into main Jul 15, 2025
19 of 20 checks passed
@golanglemonade golanglemonade deleted the windmill_integration branch July 15, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants