Skip to content

AB#20576: workflows test 3 - #533

Draft
quali-spark-agent[bot] wants to merge 2 commits into
masterfrom
spark/20576-workflows-test-3
Draft

quali-spark-agent[bot] wants to merge 2 commits into
masterfrom
spark/20576-workflows-test-3

Conversation

@quali-spark-agent

Copy link
Copy Markdown

Automated change for Azure DevOps User Story AB#20576: workflows test 3

  • Agent: docs-writer · Model: local/qwen3-coder-64k on spark-17e4
  • Checks: passed

Files changed

  • docs/workflows/workflows-use-cases.md
Agent summary
...(truncated)...
ork/20576/docs/workflows/workflows-use-cases.md
@@ -527,9 +527,91 @@
 - Prevents resource leakage that can lead to unexpected charges
 - Ensures consistent cleanup procedures across all test environments
 - Improves resource availability for subsequent tests
 
+```yaml
+spec_version: 2
+description: Cleanup test environments after testing
 
+workflow:
+  scope: environment
+  labels-selector: test-environment # will be available for all test environments
+
+inputs:
+  force_cleanup:
+    type: boolean
+    default: false
+    description: Force cleanup even if environment is not in a clean state
+
+outputs:
+  cleanup_status:
+    value: '{{ .grains.cleanup.outputs.status }}'
+
+grains:
+  cleanup:
+    kind: shell
+    spec:
+      agent:
+        name: cloud-agent
+      files:
+        - source: scripts
+          path: scripts/cleanup-test-env.sh
+      activities:
+        deploy:
+          commands:
+            - name: cleanup
+              command: 'source cleanup-test-env.sh {{ .bindings.environment_id }} {{ .inputs.force_cleanup }}'
+              outputs:
+                - status
+```
+
+**Shell script:**
+
+```bash
+#!/bin/bash
+
+environment_id=$1
+force_cleanup=$2
+
+# Set default status
+status="success"
+
+echo "Cleaning up test environment: $environment_id"
+echo "Force cleanup: $force_cleanup"
+
+# Check if the environment is a test environment and has appropriate labels
+if [ -z "$environment_id" ]; then
+    echo "Error: No environment ID provided"
+    status="error"
+    exit 1
+fi
+
+# Get environment details
+export ENV_DETAILS=$(torque env get "$environment_id" --format json)
+
+# Extract environment attributes
+env_name=$(echo $ENV_DETAILS | jq -r '.name')
+env_state=$(echo $ENV_DETAILS | jq -r '.state')
+
+# Perform cleanup actions
+echo "Cleaning up resources in environment: $env_name"
+
+# Destroy all resources in the environment (example command)
+# This would typically interact with your infrastructure management system
+if [ "$force_cleanup" = "true" ] || [ "$env_state" = "ready" ]; then
+    echo "Destroying all resources in environment $environment_id"
+    # Example: torque env delete "$environment_id" --force
+else
+    echo "Environment not in ready state, skipping cleanup ($env_state)"
+fi
+
+echo ""
+echo "Cleanup completed for environment: $environment_id"
+echo "Status: $status"
+export status
+```
+
+
 ## Torque Built-in Workflows
 
 :::info
 Usage example can be found [here](workflows-overview#torque-built-in-workflows)


Now I need to add the complete YAML workflow definition and shell script for the cleanup use-case example.
$ npm run build
> torque@0.0.0 build
> docusaurus build

[INFO] [en] Creating an optimized production build...
Browserslist: browsers data (caniuse-lite) is 14 months old. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
[SUCCESS] Generated static files in "build".
[INFO] Use `npm run serve` command to test your build locally.

$ pyspelling -c .spellcheck.yml
Spelling check passed :)

I've successfully added a new use-case example for environment cleanup automation to the workflows documentation. Here's what I changed:

1. Added a new "Cleanup Test Environments" use-case example in the "Examples & Use-cases" section
2. Included a complete YAML workflow definition following the existing format
3. Added a shell script example that demonstrates how to automate test environment cleanup
4. Maintained consistency with the existing documentation style and structure

The new example follows the same pattern as the other examples in the file, providing:
- A clear motivation for the use-case
- Benefits of implementing this workflow
- Complete YAML workflow definition with inputs, outputs, and grains
- Shell script implementation showing how to perform the cleanup tasks

Both the build and spellcheck passed successfully, confirming that the changes are valid and don't introduce any issues.
Check output
$ npm run build   (exit 0)
> torque@0.0.0 build
> docusaurus build

[INFO] [en] Creating an optimized production build...
Browserslist: browsers data (caniuse-lite) is 14 months old. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
[SUCCESS] Generated static files in "build".
[INFO] Use `npm run serve` command to test your build locally.

$ pyspelling -c .spellcheck.yml   (exit 0)
Spelling check passed :)

Generated by a local model via spark-agents. Review carefully before merging.

Generated by spark-agents/docs-writer (local/qwen3-coder-64k).

@davidbquali davidbquali left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove all yaml and code examples. leave only the motivation and benefits

Review(s) by @davidbquali. Generated by spark-agents/docs-writer (local/qwen3-coder-64k).
@quali-spark-agent

Copy link
Copy Markdown
Author

🤖 Spark revision · round 1

Addressed the review by @davidbquali.

  • Commit: 8a573ef
  • Checks: passed
  • Files: docs/workflows/workflows-use-cases.md
Where Comment Response
Review summary remove all yaml and code examples. leave only the motivation and benefits ✅ Changed: Removed all YAML and code examples from workflows use-cases document, keeping only motivation and benefits sections as requested.

Request changes again to start another round (round 1 of 3).

This branch has not been deployed

No deployments
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.

1 participant