Skip to content
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

Ability to use Waves #489

Closed
giseburt opened this issue Jan 20, 2023 · 2 comments · Fixed by #490
Closed

Ability to use Waves #489

giseburt opened this issue Jan 20, 2023 · 2 comments · Fixed by #490

Comments

@giseburt
Copy link
Contributor

giseburt commented Jan 20, 2023

This is a paired-down version of #376

Would like the ability to use Waves, as in the following modified test case:

    const pipeline = new GitHubWorkflow(app, 'Pipeline', {
      workflowPath: `${dir}/.github/workflows/deploy.yml`,
      synth: new ShellStep('Build', {
        installCommands: ['yarn'],
        commands: ['yarn build'],
      }),
      jobSettings: {
        if: "contains(github.event.issue.labels.*.name, 'deployToA') || contains(github.event.issue.labels.*.name, 'deployToB')",
      },
    });

    // Make a wave to have the stages be parallel (not depend on each other)
    const wave = pipeline.addWave('MyWave', {
      pre: [
        new GitHubActionStep('PreWaveAction', {
          jobSteps: [
            {
              name: 'pre wave action',
              uses: '[email protected]',
              with: {
                'app-id': 1234,
                'secrets': 'my-secrets',
              },
            },
          ],
        }),
      ],

      post: [
        new GitHubActionStep('PostWaveAction', {
          jobSteps: [
            {
              name: 'Checkout',
              uses: 'actions/checkout@v3',
            },
            {
              name: 'post wave action',
              uses: '[email protected]',
              with: {
                'app-id': 4321,
                'secrets': 'secrets',
              },
            },
          ],
        }),
      ],
    });

    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' },
      gitHubEnvironment: 'test',
    });
    new Stack(stageB, 'MyStackB');

    wave.addStage(stageA);
    wave.addStage(stageB);

Currently we lose the ability to use GitHubActionStep in pre and post as well as any AddGitHubStageOptions values not inherited from StageProps.

@vincentgna
Copy link

vincentgna commented Feb 2, 2023

any update? We are currently using the suggested hack:

           const options: AddGitHubStageOptions = {
                jobSettings: {
                    if: `always() &&\n!contains(needs.*.result, 'failure') &&\n!contains(needs.*.result, 'cancelled') &&\ngithub.ref_name == ${env.branch}`,
                },
            }

to decouple dependency between stages, but it would be nicer to use a wave

@giseburt
Copy link
Contributor Author

giseburt commented Feb 9, 2023

Progress is being made on the PR #490

@mergify mergify bot closed this as completed in #490 Mar 2, 2023
mergify bot pushed a commit that referenced this issue Mar 2, 2023
Fixes #489

Removed the `if`-specific code from #377 and rebased on top of the latest main.

With this PR it's possible to have Waves without losing GitHub-specific settings properties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants