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
19 |
</html>
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Azure Pipelines: Pipeline Definitions</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: Arial, sans-serif;
|
10 |
+
display: flex;
|
11 |
+
flex-direction: column;
|
12 |
+
align-items: center;
|
13 |
+
background-color: #f0f0f0;
|
14 |
+
}
|
15 |
+
h1 {
|
16 |
+
color: #0078D4;
|
17 |
+
}
|
18 |
+
#game-board {
|
19 |
+
display: grid;
|
20 |
+
grid-template-columns: repeat(5, 1fr);
|
21 |
+
gap: 10px;
|
22 |
+
margin-bottom: 20px;
|
23 |
+
}
|
24 |
+
.card {
|
25 |
+
width: 150px;
|
26 |
+
height: 100px;
|
27 |
+
background-color: #0078D4;
|
28 |
+
color: #ffffff;
|
29 |
+
display: flex;
|
30 |
+
justify-content: center;
|
31 |
+
align-items: center;
|
32 |
+
font-size: 16px;
|
33 |
+
font-weight: bold;
|
34 |
+
cursor: pointer;
|
35 |
+
transition: background-color 0.3s;
|
36 |
+
text-align: center;
|
37 |
+
}
|
38 |
+
.card:hover {
|
39 |
+
background-color: #005a9e;
|
40 |
+
}
|
41 |
+
.card.disabled {
|
42 |
+
background-color: #cccccc;
|
43 |
+
cursor: default;
|
44 |
+
}
|
45 |
+
#question-display {
|
46 |
+
width: 80%;
|
47 |
+
text-align: center;
|
48 |
+
margin-bottom: 20px;
|
49 |
+
}
|
50 |
+
#score {
|
51 |
+
font-size: 24px;
|
52 |
+
font-weight: bold;
|
53 |
+
color: #0078D4;
|
54 |
+
}
|
55 |
+
.answer-btn {
|
56 |
+
margin: 5px;
|
57 |
+
padding: 10px;
|
58 |
+
font-size: 16px;
|
59 |
+
cursor: pointer;
|
60 |
+
}
|
61 |
+
</style>
|
62 |
+
</head>
|
63 |
+
<body>
|
64 |
+
<h1>Pipeline Definitions Quiz</h1>
|
65 |
+
<p><strong>Question Reference:</strong> <a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/pipeline?view=azure-pipelines" target="_blank">Pipeline Definition Documentation</a></p>
|
66 |
+
<div id="game-board"></div>
|
67 |
+
<div id="question-display"></div>
|
68 |
+
<div id="score">Score: 0</div>
|
69 |
+
|
70 |
+
<script>
|
71 |
+
const categories = ['Pipeline Basics', 'Stages', 'Jobs', 'Steps', 'Triggers'];
|
72 |
+
const questions = [
|
73 |
+
[
|
74 |
+
{
|
75 |
+
q: "What is the basic unit of a pipeline in Azure Pipelines?",
|
76 |
+
a: ["Job", "Stage", "Step"],
|
77 |
+
correct: 1
|
78 |
+
},
|
79 |
+
{
|
80 |
+
q: "What does a pipeline consist of?",
|
81 |
+
a: ["Stages and jobs", "Only steps", "Just a random series of scripts"],
|
82 |
+
correct: 0
|
83 |
+
},
|
84 |
+
{
|
85 |
+
q: "Can a pipeline run without a stage?",
|
86 |
+
a: ["No", "Yes", "Only if it skips to jobs"],
|
87 |
+
correct: 1
|
88 |
+
}
|
89 |
+
],
|
90 |
+
[
|
91 |
+
{
|
92 |
+
q: "What are stages in a pipeline?",
|
93 |
+
a: ["Containers for scripts", "A group of jobs", "An unnecessary complication"],
|
94 |
+
correct: 1
|
95 |
+
},
|
96 |
+
{
|
97 |
+
q: "What defines the sequence of stages?",
|
98 |
+
a: ["Your wishful thinking", "A dependency graph", "Job descriptions"],
|
99 |
+
correct: 1
|
100 |
+
},
|
101 |
+
{
|
102 |
+
q: "What is the role of a pool in a stage?",
|
103 |
+
a: ["To swim?", "Assigns jobs to an agent", "Holds resources"],
|
104 |
+
correct: 1
|
105 |
+
}
|
106 |
+
],
|
107 |
+
[
|
108 |
+
{
|
109 |
+
q: "What is a job in an Azure Pipeline?",
|
110 |
+
a: ["A single step", "A unit of work assigned to an agent", "Just something that gets done"],
|
111 |
+
correct: 1
|
112 |
+
},
|
113 |
+
{
|
114 |
+
q: "How are jobs organized in a pipeline?",
|
115 |
+
a: ["In a linear series", "Randomly", "In a parallel universe"],
|
116 |
+
correct: 0
|
117 |
+
},
|
118 |
+
{
|
119 |
+
q: "What happens if a job fails?",
|
120 |
+
a: ["The pipeline stops", "Everything explodes", "You try again"],
|
121 |
+
correct: 0
|
122 |
+
}
|
123 |
+
],
|
124 |
+
[
|
125 |
+
{
|
126 |
+
q: "What is a step in a pipeline?",
|
127 |
+
a: ["A discrete task", "A failed attempt", "An action-packed script"],
|
128 |
+
correct: 0
|
129 |
+
},
|
130 |
+
{
|
131 |
+
q: "Can you mix tasks and scripts in steps?",
|
132 |
+
a: ["Yes, like a good recipe", "No, only tasks", "Scripts only"],
|
133 |
+
correct: 0
|
134 |
+
},
|
135 |
+
{
|
136 |
+
q: "What is the smallest unit of execution in a pipeline?",
|
137 |
+
a: ["A step", "A job", "A pool"],
|
138 |
+
correct: 0
|
139 |
+
}
|
140 |
+
],
|
141 |
+
[
|
142 |
+
{
|
143 |
+
q: "What does a trigger do in a pipeline?",
|
144 |
+
a: ["Makes sure something happens", "Starts a pipeline run", "Activates the next step"],
|
145 |
+
correct: 1
|
146 |
+
},
|
147 |
+
{
|
148 |
+
q: "How do you specify a continuous integration (CI) trigger?",
|
149 |
+
a: ["Use trigger: none", "Specify branches or events", "Hope for the best"],
|
150 |
+
correct: 1
|
151 |
+
},
|
152 |
+
{
|
153 |
+
q: "What is the purpose of the 'trigger' keyword in YAML?",
|
154 |
+
a: ["To summon agents", "To define CI triggers", "To exclude branches"],
|
155 |
+
correct: 1
|
156 |
+
}
|
157 |
+
]
|
158 |
+
];
|
159 |
+
let score = 0;
|
160 |
+
let timeoutId;
|
161 |
+
const gameBoard = document.getElementById('game-board');
|
162 |
+
const questionDisplay = document.getElementById('question-display');
|
163 |
+
const scoreDisplay = document.getElementById('score');
|
164 |
+
function createBoard() {
|
165 |
+
for (let i = 0; i < 5; i++) {
|
166 |
+
for (let j = 0; j < 3; j++) {
|
167 |
+
const card = document.createElement('div');
|
168 |
+
card.className = 'card';
|
169 |
+
card.textContent = `${categories[i]} $${(j + 1) * 100}`;
|
170 |
+
card.onclick = () => showQuestion(i, j, card);
|
171 |
+
gameBoard.appendChild(card);
|
172 |
+
}
|
173 |
+
}
|
174 |
+
}
|
175 |
+
function showQuestion(category, difficulty, cardElement) {
|
176 |
+
if (cardElement.classList.contains('disabled')) return;
|
177 |
+
if (timeoutId) {
|
178 |
+
clearTimeout(timeoutId);
|
179 |
+
timeoutId = null;
|
180 |
+
}
|
181 |
+
const question = questions[category][difficulty];
|
182 |
+
let answerHtml = question.a.map((answer, index) =>
|
183 |
+
`<button class="answer-btn" onclick="checkAnswer(${category}, ${difficulty}, ${index})">${answer}</button>`
|
184 |
+
).join('');
|
185 |
+
questionDisplay.innerHTML = `
|
186 |
+
<h2>${categories[category]} for $${(difficulty + 1) * 100}</h2>
|
187 |
+
<p>${question.q}</p>
|
188 |
+
${answerHtml}
|
189 |
+
`;
|
190 |
+
cardElement.classList.add('disabled');
|
191 |
+
cardElement.style.backgroundColor = '#cccccc';
|
192 |
+
cardElement.style.cursor = 'default';
|
193 |
+
}
|
194 |
+
function checkAnswer(category, difficulty, selectedAnswer) {
|
195 |
+
const buttons = document.querySelectorAll('.answer-btn');
|
196 |
+
buttons.forEach(btn => btn.disabled = true);
|
197 |
+
const question = questions[category][difficulty];
|
198 |
+
const isCorrect = selectedAnswer === question.correct;
|
199 |
+
const value = (difficulty + 1) * 100;
|
200 |
+
if (isCorrect) {
|
201 |
+
score += value;
|
202 |
+
questionDisplay.innerHTML += `<p style="color: green;">Correct! You earned $${value}.</p>`;
|
203 |
+
} else {
|
204 |
+
score -= value;
|
205 |
+
questionDisplay.innerHTML += `<p style="color: red;">Sorry, that's incorrect. You lost $${value}. The correct answer was: ${question.a[question.correct]}</p>`;
|
206 |
+
}
|
207 |
+
scoreDisplay.textContent = `Score: ${score}`;
|
208 |
+
timeoutId = setTimeout(() => {
|
209 |
+
clearQuestion();
|
210 |
+
checkGameCompletion();
|
211 |
+
}, 2000);
|
212 |
+
}
|
213 |
+
function clearQuestion() {
|
214 |
+
questionDisplay.innerHTML = '';
|
215 |
+
}
|
216 |
+
function checkGameCompletion() {
|
217 |
+
const remainingCards = document.querySelectorAll('.card:not(.disabled)');
|
218 |
+
if (remainingCards.length === 0) {
|
219 |
+
questionDisplay.innerHTML = `<h2>Game Over!</h2><p>Your final score is $${score}.</p>`;
|
220 |
+
}
|
221 |
+
}
|
222 |
+
createBoard();
|
223 |
+
</script>
|
224 |
+
</body>
|
225 |
</html>
|