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

Add GitHub Actions detection and update the Pulumi CI escape hatch with more CI vars #4758

Merged
merged 6 commits into from
Jun 9, 2020

Conversation

praneetloke
Copy link
Contributor

This PR adds the detection logic for GitHub Actions. I have also updated our escape-hatch code for unknown CI systems to allow users to set all CI vars that we support today.

This PR might address the problem reported in #4613.

@praneetloke praneetloke self-assigned this Jun 5, 2020
func (t githubActionsCI) DetectVars() Vars {
v := Vars{Name: GitHubActions}
v.BuildID = os.Getenv("GITHUB_RUN_ID")
v.BuildNumber = os.Getenv("GITHUB_RUN_NUMBER")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the human-friendly number to show in the UI:
image

// See https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables.
func (t githubActionsCI) DetectVars() Vars {
v := Vars{Name: GitHubActions}
v.BuildID = os.Getenv("GITHUB_RUN_ID")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the ID that goes in the URL. For example, https://github.com/pulumi/docs/actions/runs/126408154.

Copy link
Contributor

@jkisk jkisk left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@chrsmith chrsmith left a comment

Choose a reason for hiding this comment

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

LGTM!


// DetectVars detects the GitHub Actions env vars.
// nolint: lll
// See https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: We can probably trim off the #default-environment-variables. part.

@praneetloke praneetloke force-pushed the praneetloke/github-actions-ci branch from 0bad44a to d4bd56e Compare June 8, 2020 21:42
@praneetloke
Copy link
Contributor Author

Thank you, @jkisk and @chrsmith for reviewing the PR. I rebased my branch just now. As soon as it passes, I'll merge this.

@praneetloke praneetloke merged commit 4078967 into master Jun 9, 2020
@pulumi-bot pulumi-bot deleted the praneetloke/github-actions-ci branch June 9, 2020 00:24
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