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

1332 workflow restrictions #1462

Merged
merged 6 commits into from
Jan 12, 2023

Conversation

bob-bins
Copy link
Contributor

@bob-bins bob-bins commented Jan 5, 2023

Resolves #1332


Behavior

Supports the following options in resource github_actions_runner_group

restricted_to_workflows bool
selected_workflows []string

Additional info

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Added the appropriate label for the given change

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes (Please add the Type: Breaking change label)
  • No

If Yes, what's the impact:

  • N/A

Pull request type

Please add the corresponding label for change this PR introduces:

  • Bugfix: Type: Bug
  • Feature/model/API additions: Type: Feature
  • Updates to docs or samples: Type: Documentation
  • Dependencies/code cleanup: Type: Maintenance

@@ -26,6 +26,8 @@ func TestAccGithubActionsRunnerGroup(t *testing.T) {
resource "github_actions_runner_group" "test" {
name = github_repository.test.name
visibility = "all"
restricted_to_workflows = true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't think i can run these tests... i think they require an enterprise account?

Copy link
Member

Choose a reason for hiding this comment

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

On main, I'm getting a failure on these acceptance tests:

--- FAIL: TestAccGithubActionsRunnerGroup (47.67s)
    --- FAIL: TestAccGithubActionsRunnerGroup/creates_runner_groups_without_error (12.52s)
        --- SKIP: TestAccGithubActionsRunnerGroup/creates_runner_groups_without_error/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/creates_runner_groups_without_error/with_an_individual_account (0.00s)
        --- FAIL: TestAccGithubActionsRunnerGroup/creates_runner_groups_without_error/with_an_organization_account (12.52s)
    --- FAIL: TestAccGithubActionsRunnerGroup/manages_runner_visibility (11.71s)
        --- SKIP: TestAccGithubActionsRunnerGroup/manages_runner_visibility/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/manages_runner_visibility/with_an_individual_account (0.00s)
        --- FAIL: TestAccGithubActionsRunnerGroup/manages_runner_visibility/with_an_organization_account (11.71s)
    --- FAIL: TestAccGithubActionsRunnerGroup/imports_an_all_runner_group_without_error (11.47s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_an_all_runner_group_without_error/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_an_all_runner_group_without_error/with_an_individual_account (0.00s)
        --- FAIL: TestAccGithubActionsRunnerGroup/imports_an_all_runner_group_without_error/with_an_organization_account (11.47s)
    --- PASS: TestAccGithubActionsRunnerGroup/imports_a_private_runner_group_without_error (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_a_private_runner_group_without_error/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_a_private_runner_group_without_error/with_an_individual_account (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_a_private_runner_group_without_error/with_an_organization_account (0.00s)
    --- FAIL: TestAccGithubActionsRunnerGroup/imports_a_selected_runner_group_without_error (11.98s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_a_selected_runner_group_without_error/with_an_individual_account (0.00s)
        --- FAIL: TestAccGithubActionsRunnerGroup/imports_a_selected_runner_group_without_error/with_an_organization_account (11.98s)
FAIL

On this branch, I'm seeing a panic on line 179 of github/resource_github_actions_runner_group.go:

d.Set("selected_workflows", runnerGroup.SelectedWorkflows).

The error reads panic: runtime error: invalid memory address or nil pointer dereference. Can you reproduce that when you run these tests on the branch locally?

Copy link
Contributor Author

@bob-bins bob-bins Jan 7, 2023

Choose a reason for hiding this comment

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

I'm not able to successfully run the TestAccGithubActionsRunnerGroup tests even from the main branch, so it makes it difficult for me to verify my own PR (other tests work file however). I think these tests require me to have an Enterprise Account, which I do not have on my personal account. Hm...

Copy link
Member

Choose a reason for hiding this comment

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

Ohh that makes sense. We currently don't have a framework in place for enterprise testing, although it's on the TODO list in the effort starting with #1414.

CONTRIBUTING.md Show resolved Hide resolved
@@ -26,6 +26,8 @@ func TestAccGithubActionsRunnerGroup(t *testing.T) {
resource "github_actions_runner_group" "test" {
name = github_repository.test.name
visibility = "all"
restricted_to_workflows = true
Copy link
Member

Choose a reason for hiding this comment

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

On main, I'm getting a failure on these acceptance tests:

--- FAIL: TestAccGithubActionsRunnerGroup (47.67s)
    --- FAIL: TestAccGithubActionsRunnerGroup/creates_runner_groups_without_error (12.52s)
        --- SKIP: TestAccGithubActionsRunnerGroup/creates_runner_groups_without_error/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/creates_runner_groups_without_error/with_an_individual_account (0.00s)
        --- FAIL: TestAccGithubActionsRunnerGroup/creates_runner_groups_without_error/with_an_organization_account (12.52s)
    --- FAIL: TestAccGithubActionsRunnerGroup/manages_runner_visibility (11.71s)
        --- SKIP: TestAccGithubActionsRunnerGroup/manages_runner_visibility/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/manages_runner_visibility/with_an_individual_account (0.00s)
        --- FAIL: TestAccGithubActionsRunnerGroup/manages_runner_visibility/with_an_organization_account (11.71s)
    --- FAIL: TestAccGithubActionsRunnerGroup/imports_an_all_runner_group_without_error (11.47s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_an_all_runner_group_without_error/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_an_all_runner_group_without_error/with_an_individual_account (0.00s)
        --- FAIL: TestAccGithubActionsRunnerGroup/imports_an_all_runner_group_without_error/with_an_organization_account (11.47s)
    --- PASS: TestAccGithubActionsRunnerGroup/imports_a_private_runner_group_without_error (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_a_private_runner_group_without_error/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_a_private_runner_group_without_error/with_an_individual_account (0.00s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_a_private_runner_group_without_error/with_an_organization_account (0.00s)
    --- FAIL: TestAccGithubActionsRunnerGroup/imports_a_selected_runner_group_without_error (11.98s)
        --- SKIP: TestAccGithubActionsRunnerGroup/imports_a_selected_runner_group_without_error/with_an_individual_account (0.00s)
        --- FAIL: TestAccGithubActionsRunnerGroup/imports_a_selected_runner_group_without_error/with_an_organization_account (11.98s)
FAIL

On this branch, I'm seeing a panic on line 179 of github/resource_github_actions_runner_group.go:

d.Set("selected_workflows", runnerGroup.SelectedWorkflows).

The error reads panic: runtime error: invalid memory address or nil pointer dereference. Can you reproduce that when you run these tests on the branch locally?

@nickfloyd nickfloyd added Type: Feature New feature or request Priority: Normal labels Jan 5, 2023
* update  documentation with new params
@bob-bins bob-bins force-pushed the 1332-workflow-restrictions branch from d381f29 to 8c7edb6 Compare January 7, 2023 19:58
Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

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

Hey @bob-bins thanks again for the contributions here! ❤️

@nickfloyd nickfloyd merged commit 5ba2241 into integrations:main Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support workflow restrictions in github_actions_runner_group
3 participants