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

Update PANTHEON_SITE_NAME and TERMINUS_PLUGINS to prefer variables over secrets #470

Merged
merged 7 commits into from Mar 19, 2024

Conversation

davereid
Copy link
Member

@davereid davereid commented Mar 7, 2024

Fixes #463

By setting PANTHEON_SITE_NAME as a secret, it will always be masked in job output, and you will be completely unable to use it in any action variable outputs, which is important if you want to pass the final Pantheon review URL to other subsequent jobs or workflows. Secrets were the only option at the time and GitHub variables at the organizaiton and repository level are relatively new and designed to hold non-secret information.

Documentation has also been updated.

I have added the variable to this repository as well, but since it's still set as a secret. It seems to be working, but since we still have the secret defined with the same value, it's getting masked still in job output.

@github-actions github-actions bot temporarily deployed to pantheon-pr-470 March 7, 2024 16:07 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-470 March 7, 2024 16:12 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-470 March 7, 2024 16:17 Destroyed
@davereid davereid self-assigned this Mar 7, 2024
@davereid davereid marked this pull request as ready for review March 7, 2024 16:23
@davereid davereid requested a review from YesCT March 7, 2024 16:24
@github-actions github-actions bot temporarily deployed to pantheon-pr-470 March 7, 2024 16:46 Destroyed
Copy link
Contributor

@YesCT YesCT left a comment

Choose a reason for hiding this comment

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

I read through the changes. They seem reasonable.

Looks backwards compatible too!

I also checked if there were any places missed adding the || (or).

Screenshot 2024-03-12 at 4 27 54 PM

No spots missed. 👍

I did not manually test this out.

- `SSH_PRIVATE_KEY` A private key of a user which can push to Pantheon
- `SSH_KNOWN_HOSTS` The result of running `ssh-keyscan -H codeserver.dev.$PANTHEON_SITE_ID.drush.in`
- Add the following [variables to your GitLab repository](https://docs.gitlab.com/ee/ci/variables/#for-a-project):
- `PANTHEON_TERMINUS_TOKEN` See https://pantheon.io/docs/terminus/install#machine-token (enable the _Mask variable_ checkbox)
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting. GitLab uses variables, but can mask the variable! TIL.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming since they were varables already for gitlab, that there isn't any change needed in the gitlab action. yeah, looks that way since https://github.com/Lullabot/drainpipe/blob/main/scaffold/gitlab/PantheonReviewApps.gitlab-ci.yml doesn't specify variable or secret.

- Add the following [variables to your GitHub repository](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository):
- `PANTHEON_SITE_NAME` The canonical site name in Pantheon
- `TERMINUS_PLUGINS` (optional) Comma-separated list of Terminus plugins to be available
- Add the following [secrets to your GitHub repository](https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/managing-development-environment-secrets-for-your-repository-or-organization#adding-secrets-for-a-repository):
- `PANTHEON_TERMINUS_TOKEN` See https://pantheon.io/docs/terminus/install#machine-token
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, this is the gitHUB section. The hunk below is the gitLAB section.

@YesCT
Copy link
Contributor

YesCT commented Mar 12, 2024

Error fail is

Error: [>---------------------------] Create a Multidev environment [error] The maximum number of Multidev environment for this service level has been reached.
Failed to execute command terminus multidev:create ***.live pr-470 --no-db --no-files --yes: exit status 1
Error: Process completed with exit code 1.

Is there something to clean out??

@davereid
Copy link
Member Author

Error fail is

Error: [>---------------------------] Create a Multidev environment [error] The maximum number of Multidev environment for this service level has been reached.
Failed to execute command terminus multidev:create ***.live pr-470 --no-db --no-files --yes: exit status 1
Error: Process completed with exit code 1.

Is there something to clean out??

The secret is still set because it would fail on other PRs until this has been merged, so it's still showing as masked. When I remove it from this repo, after this is merged, we should be able to test confidently.

@YesCT
Copy link
Contributor

YesCT commented Mar 14, 2024

Huh, so could the error be "incorrect secret" or something? Why would it say maximum mulitdevs?

Feel free to disregard. I get that some fail is expected.

@davereid
Copy link
Member Author

This fail is happening in all of our PRs because we've exceeded the number of multidevs that Pantheon allows, I wish we could resolve that so we could truly test if this works or not.

@YesCT
Copy link
Contributor

YesCT commented Mar 14, 2024

We could manually go in to the pantheon dashboard and delete the multidevs. (Might hit the quota again as people push new commits, but should relieve the issue temporarily.)

@github-actions github-actions bot temporarily deployed to pantheon-pr-470 March 18, 2024 20:54 Destroyed
@justafish
Copy link
Member

Thanks!

@justafish justafish merged commit 326762b into main Mar 19, 2024
35 checks passed
@justafish justafish deleted the davereid/463-patheon-site-name-var branch March 19, 2024 11:36
@davereid
Copy link
Member Author

I removed the secret set in this repository so now we are only using the variable version which means that we can now see the word "drainpipe" in all the log output, hooray!

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.

Change some values from secrets to variables, for example PANTHEON_SITE_NAME
3 participants