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

feat: support review apps #799

Merged
merged 1 commit into from
Mar 3, 2025
Merged

feat: support review apps #799

merged 1 commit into from
Mar 3, 2025

Conversation

rowanmanning
Copy link
Member

@rowanmanning rowanmanning commented Feb 28, 2025

Description

This adds in an option to run hako deploy with an "ephemeral" app, which is a similar concept to Heroku review apps. To make this work we need to pass Hako config into the Docker command as STDIN.

This also updates the two wrapper plugins to introduce a deploy:review command.

This was all tested locally in cp-docker-migration-canary. It works aside from an issue with name length, we're talking to Cloud Enablement about this fixed

This relies on https://github.com/Financial-Times/hako-cli/pull/324

Checklist:

  • My branch has been rebased onto the latest commit on main (don't merge main into your branch)
  • My commit messages are conventional commits, for example: feat(circleci): add support for nightly workflows, fix: set Heroku app name for staging apps too

@rowanmanning rowanmanning requested a review from a team February 28, 2025 12:02
This adds in an option to run hako deploy with an "ephemeral" app, which
is a similar concept to Heroku review apps. To make this work we need to
pass Hako config into the Docker command as STDIN.

This also updates the two wrapper plugins to introduce a `deploy:review`
command.

This was all tested locally in cp-docker-migration-canary. It works
aside from an issue with name length, we're talking to Cloud Enablement
about this.

Co-Authored-By: Alex Muller <[email protected]>
@rowanmanning rowanmanning marked this pull request as ready for review March 3, 2025 15:24
@rowanmanning rowanmanning requested a review from a team as a code owner March 3, 2025 15:24
Copy link
Contributor

@CyntiBinti CyntiBinti left a comment

Choose a reason for hiding this comment

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

woohoo 🙌🏽 Just 1 suggestion from me!

@rowanmanning rowanmanning requested a review from CyntiBinti March 3, 2025 16:26
Copy link
Contributor

@olusoladavid olusoladavid left a comment

Choose a reason for hiding this comment

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

LGTM, great work. Thanks

throw new Error(`Hako config not found at ${hakoConfigPath}`)
}
}
child.stdin.end()
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: beautifully done

Copy link
Contributor

@CyntiBinti CyntiBinti left a comment

Choose a reason for hiding this comment

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

👌🏽 Lets go!

Comment on lines +77 to +78
// Because we can't mount volumes in Docker images on CircleCI we have to
// pass the hako config via STDIN
Copy link
Contributor

Choose a reason for hiding this comment

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

question: why can't we include the hako-config file in the Docker build context instead of passing it in at runtime?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because of this, Docker is incapable of mounting volumes (and thus reading files) in CircleCI unless you use a machine executor which would require us to make a lot of CircleCI config changes.

More detail here, sorry I should have linked this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh wait that wasn't what you were asking. Because the docker run in question is Hako, not the image we built

Copy link
Contributor

@ivomurrell ivomurrell Mar 3, 2025

Choose a reason for hiding this comment

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

Sorry, I mean why can't we include the hako-config/apps/.../app.yaml file in the Docker image we build in the DockerBuild task – but the answer is because we're running the hako image here not the image we've built (edit: like you say) 😰 This approach makes sense then (though I hope we'll get to a point where Hako doesn't (officially) require Docker some day)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I'd like that too 😂 would simplify some things but I'm sure introduce some fun different issues. The stdin stuff was also a big pain for Cloud Enablement to implement

Copy link
Contributor

@ivomurrell ivomurrell left a comment

Choose a reason for hiding this comment

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

🎉

@rowanmanning rowanmanning merged commit 3e15f55 into main Mar 3, 2025
17 checks passed
@rowanmanning rowanmanning deleted the hako-review-apps branch March 3, 2025 17:12
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