Skip to content

Conversation

@zweatshirt
Copy link
Contributor

@zweatshirt zweatshirt commented Aug 26, 2025

  • Adds build job to deploy dependencies/needs list. Deploy should not occur if build fails. Deploy also attempts to build. It is my understanding that it is a good measure to check build status before deploy.

@zweatshirt zweatshirt requested a review from dr-bizz August 26, 2025 16:26
@zweatshirt zweatshirt marked this pull request as ready for review August 26, 2025 16:27
@zweatshirt zweatshirt changed the title Adds needed build check for deploy job Adds needed build check before deploy Aug 26, 2025
@zweatshirt zweatshirt changed the title Adds needed build check before deploy Adds build job to needs list for safer deploy Aug 26, 2025
environment:
name: ${{ (github.ref == 'refs/heads/master' && 'production') || 'staging' }}
needs: [lint, test]
needs: [lint, test, build]
Copy link
Contributor

Choose a reason for hiding this comment

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

What scenario does this prevent against? If the build job would fail, wouldn't the yarn run build step in this deployment job fail also and abort the deployment anyway?

Copy link
Contributor Author

@zweatshirt zweatshirt Aug 28, 2025

Choose a reason for hiding this comment

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

That's true. It was my thought that that increases the time it takes for the workflow to process. If build fails, it didn't seem practical to re-run build in the deployment job despite failure. Maybe I am misunderstanding it. I guess it doesn't matter, since build will be flagged as fail anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a good point that it avoids rebuilding if the first build fails. Thanks for thinking of that improvement!

I'm thinking that this will make deployments slower though when the build succeeds. Now it will have to build, wait, then rebuild and deploy. Before the two builds could run in parallel and now they must run sequentially. I lean towards optimizing for the speed of deploying successful builds. Although in practice, building usually takes only ~15 seconds longer than running the tests, so this change wouldn't slow things down too much.

Copy link
Contributor

Choose a reason for hiding this comment

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

In practice, I prefer that we have a successful build first before trying to deploy. I know this is happening anyway, as the deploy job runs a build.

I'm not fussed; I can go either way.

I will say our normal process is to build, and then once it's successful, we deploy. MPDX works this way.

Since we build on the CI when asking Amplify to deploy. Then Amplify runs a build to deploy.

Copy link
Contributor

@dr-bizz dr-bizz left a comment

Choose a reason for hiding this comment

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

I don't mind the change Zach is requesting

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 this pull request may close these issues.

4 participants