Better flow control: Ability to use Waves, set `if` on individual stages/steps
Nessuno ha ancora preso questa issue.
- #377 di @giseburt — chiusa senza merge
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- github-actions, typescript
Direzione di ricerca
Inizia dalla discussione in #365 e dagli entry point proposti GitHubWorkflow, GitHubStage e addWave, quindi esamina la PR pronta menzionata nell’issue. Verifica che il workflow di esempio produca i quattro job descritti, incluse le espressioni if a livello di stage e le dipendenze basate sulle wave; il lavoro è completato quando i job e le dipendenze generati corrispondono al comportamento indicato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This continues from the discussion in #365 with the if control.
Looking at the docs for jobs.<job_id>.if, it appears that:
- The
ifstatement, if present, can allow a step to build if dependent steps (injobs.<job_id>.needs) fail, skip, or are cancelled. - The
ifstatement, if omitted, is the same asif: success()[^1] - The
ifexpression options that allow bypassing failure are: (Same reference.)always()- ignores failure AND cancellationfailure()- ONLY on failurecancelled()- ONLY if the workflow was cancelledsuccess() || failure()- unlikealways()this allows cancellation of a step
- If a previous step is skipped then the
ifskips dependent steps unless one of the above expressions is added, known issue: actions/runner#491- The best proposed solution for NOT skipping dependent steps, but also not running the if there's been a failure:
if: | always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && <ACTUAL TEST INTENDED HERE> - Closely related is
jobs.<job_id>.continue-on-error- which allows a job to act as if it succeeds even when it fails, making a job that cannot fail
1, 2, and 4 means that we only need the if statement on the build phase, and can skip if statements on publish steps. Depending on how 4 gets "fixed" either an if will need to be added with !(failure() || cancelled()) (As this workflow run demonstrates).
I see no value on adding (customized) if statements on publish jobs in the absence of a way to correlate the asset being deployed with some tangible asset name. Even then the value is dubious, since it'll likely invalidate the deployment since asset publish steps are shared by deployment steps that use those assets.
In a closely related issue, needs is used to handle dependencies, which the only way to make a stage NOT depend on another stage is with pipeline.addWave(), but that doesn't support GitHub options such as this if in the current code.
In the PR i have ready, this code works as expected (explained more below):
const pipeline = new GitHubWorkflow(app, 'Pipeline', {
workflowPath: `${dir}/.github/workflows/deploy.yml`,
synth: new ShellStep('Build', {
installCommands: ['yarn'],
commands: ['yarn build'],
}),
});
const stageA = new GitHubStage(app, 'MyStageA', {
env: { account: '111111111111', region: 'us-east-1' },
jobSettings: {
if: "success() && contains(github.event.issue.labels.*.name, 'deployToA')",
},
});
new Stack(stageA, 'MyStackA');
const stageB = new GitHubStage(app, 'MyStageB', {
env: { account: '12345678901', region: 'us-east-1' },
jobSettings: {
if: "success() && contains(github.event.issue.labels.*.name, 'deployToB')",
},
});
new Stack(stageB, 'MyStackB');
// Make a wave to have the stages be parallel (not depend on each other)
const wave = pipeline.addWave('MyWave');
wave.addStage(stageA);
wave.addStage(stageB);
This makes four jobs:
Build-Build- withifsetAssets-FileAsset1- needsBuild-Buildbut doesn't haveifset otherwiseMyWave-MyStageA-MyStackA-Deploy- needsBuild-BuildandAssets-FileAsset1and has the correctifsetMyWave-MyStageB-MyStackB-Deploy- also needsBuild-BuildandAssets-FileAsset1and has the correctifset- If it were
pipeline.addStage(stageA);andpipeline.addStage(stageB);then there would be an additional needs value ofMyWave-MyStageA-MyStackA-Deploy
- If it were
Obviously there's a new construct GitHubStage, and a new GitHubWorkflow.addWave(). We can discuss technical details in the PR about how these work and if we want to maintain those names, etc.
[^1]: According to the docs here:
> You can use the following status check functions as expressions in if conditionals. A default status check of success() is applied unless you include one of these functions.
- Lingua principale
- TypeScript
- Stelle
- 385
- Fork
- 45
- Merge medio
- 1g 52m
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cdklabs/cdk-pipelines-github
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
cdklabs/cdk-pipelines-github#1466 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
cdklabs/cdk-pipelines-github#1460 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
cdklabs/cdk-pipelines-github#1456 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 55/100
cdklabs/cdk-pipelines-github#1443 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
cdklabs/cdk-pipelines-github#1421 · 1 commento · 1 reazione ·
Tutte le issue di cdklabs/cdk-pipelines-github
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
melgarafael/DeskcommCRM#3000 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
callstackincubator/simlock#639 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
aws/agentcore-cli#2606 ·
I maintainer di solito rispondono entro 1 giorno
-
🐛 [BUG] - FeatureComparisonTable text-only cells are top-aligned while icon cells are centeredAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 7 giorni
-
ai-driven-qa bug Cosmetic
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno