Download server/tasks/task_3_workflow_syntax.py from jester1177/cloudnative-devops-debug-env: direct link, hf CLI and curl.
- Browser
- Download file 1.82 kB
-
https://huggingface.co/spaces/jester1177/cloudnative-devops-debug-env/resolve/deb4824b65679a3203d50d899345b5a8d08832ad/server/tasks/task_3_workflow_syntax.py
- Command line
-
hf download hf://spaces/jester1177/cloudnative-devops-debug-env@deb4824b65679a3203d50d899345b5a8d08832ad/server/tasks/task_3_workflow_syntax.py
-
curl -L -o task_3_workflow_syntax.py https://huggingface.co/spaces/jester1177/cloudnative-devops-debug-env/resolve/deb4824b65679a3203d50d899345b5a8d08832ad/server/tasks/task_3_workflow_syntax.py
1.82 kB
| from __future__ import annotations | |
| import random | |
| from typing import Dict, Optional | |
| from server.models import TaskDifficulty | |
| from server.tasks.base import BaseTask | |
| class WorkflowSyntaxStructureTask(BaseTask): | |
| NAME = "Workflow Syntax and Structure" | |
| DESCRIPTION = "Fix GitHub Actions YAML syntax and job structure issues" | |
| DIFFICULTY = TaskDifficulty.EASY | |
| AVAILABLE_SECRETS = ["GITHUB_TOKEN"] | |
| SCENARIOS = [ | |
| { | |
| "id": "checkout_after_build", | |
| "files": [ | |
| { | |
| "path": ".github/workflows/build.yml", | |
| "type": "workflow", | |
| "content": "name: Build\non: push\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - name: Build Docker image\n run: docker build -t myapp .\n - uses: actions/checkout@v4", | |
| }, | |
| {"path": "Dockerfile", "type": "dockerfile", "content": "FROM python:3.11-slim\nWORKDIR /app\nCOPY . ."}, | |
| ], | |
| "error": { | |
| "phase": "workflow_parse", | |
| "message": "Build step runs before source checkout", | |
| }, | |
| "expected_fixes": [ | |
| { | |
| "file": ".github/workflows/build.yml", | |
| "type": "contains", | |
| "expected": "- uses: actions/checkout@v4", | |
| "hint": "Checkout should happen before build commands", | |
| } | |
| ], | |
| } | |
| ] | |
| def load_scenario(self, scenario_id: Optional[str] = None) -> Dict: | |
| if scenario_id: | |
| for scenario in self.SCENARIOS: | |
| if scenario["id"] == scenario_id: | |
| return scenario | |
| raise ValueError(f"Unknown scenario: {scenario_id}") | |
| return random.choice(self.SCENARIOS) | |