Skip to content

Conversation

@florianesser
Copy link
Member

Extend GitHub Actions to automatically deploy the build output of a PR to a staging environment under a unique path.

To preserve disk space, the deployment is removed when the PR is either merged or closed.

ING-4710

Extend GitHub Actions to automatically deploy the build output of a PR to a
staging environment under a unique path.

To preserve disk space, the deployment is removed when the PR is either
merged or closed.

ING-4710
@florianesser
Copy link
Member Author

In case the approach is generally OK, I'd go ahead and add the required GHA secrets (SSH_USERNAME, SSH_KEY, etc.) and update the required check configuration.

Copy link
Member

@stempler stempler left a comment

Choose a reason for hiding this comment

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

Looks good to me in principle, except for the known hosts (see comment).

Which server is used to host the files?

In hale-core I had used pr-preview-action to do similar thing in GitHub Pages, though I think both options are viable (and have their own specific advantages and disadvantages).

mkdir -p ~/.ssh
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
Copy link
Member

Choose a reason for hiding this comment

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

I think this kind of works against the purpose of known hosts and this should probably rather be a specific secret or variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely, thanks for the hint. I introduced a new secret SSH_KNOWN_HOSTS.

@florianesser
Copy link
Member Author

Which server is used to host the files?

I created a Hetzner Cloud VM for it to get a quick solution for testing the major upgrade and allow challenging. My plan was to potentially migrate that to the tools cluster later.

In hale-core I had used pr-preview-action to do similar thing in GitHub Pages, though I think both options are viable (and have their own specific advantages and disadvantages).

I wasn't aware of that, thanks for the pointer! I think it would actually be the preferrable option, as it avoids us having to manage a separate staging instance. I'll look into it.

@stempler
Copy link
Member

I wasn't aware of that, thanks for the pointer! I think it would actually be the preferrable option, as it avoids us having to manage a separate staging instance. I'll look into it.

Downside of the other approach is that it can "pollute" the repository with a lot of extra commits, even if not on the working branches.
IIRC there is a redirect involved when accessing the preview and I think the browser caching caused some problems here.

@florianesser
Copy link
Member Author

The current approach with deploying PR builds to a path like /pr/XXX doesn't work yet because links on the site don't automatically pick up the base path. A possible solution might be to configure routeBasePath somehow (see documentation on routing).

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.

3 participants