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(ci): parameterise out github account #210

Merged

Conversation

lewismiddleton
Copy link
Contributor

Description

Parameterises the github_account and github_repo used in the molecule test suite. Pulls these values from environment variables instead of hard coding. Had to change Github Workflows to account for this change.

This makes testing more approachable for other contributors as they don't have to make changes to the working directory to run tests.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Small minor change not affecting the Ansible Role code (Github Actions Workflow, Documentation etc.)

How Has This Been Tested?

I've run all 4 test scenarios against a Github org that I maintain. 3 of them (default, repo, org) passed, the custom_env scenario failed for an unrelated reason, I'll add a comment to this PR explaining what I think the issue is.

Parameterises the `github_account` and `github_repo` used in the
`molecule` test suite. Pulls these values from environment variables
instead of hard coding.

This makes testing more approachable for other contributors.
@lewismiddleton
Copy link
Contributor Author

lewismiddleton commented May 22, 2024

I think the custom_env test scenario is broken because the verify.yaml stage is expecting to find a runner called ubuntu16-latest but this is not specified at the converge.yaml stage so defaults to the hostname (ubuntu22-latest) .

This results in an error
TASK [Debug | var registered_runners] ******************************************
ok: [ubuntu22-latest] => {
    "registered_runners.json.runners": [
        {
            "busy": false,
            "id": 29,
            "labels": [
                {
                    "id": 1,
                    "name": "self-hosted",
                    "type": "read-only"
                },
                {
                    "id": 2,
                    "name": "Linux",
                    "type": "read-only"
                },
                {
                    "id": 3,
                    "name": "X64",
                    "type": "read-only"
                },
                {
                    "id": 4,
                    "name": "label1",
                    "type": "custom"
                },
                {
                    "id": 5,
                    "name": "repo-runner",
                    "type": "custom"
                }
            ],
            "name": "ubuntu22-latest",
            "os": "Linux",
            "status": "online"
        }
    ]
}

TASK [Check Runner] ************************************************************
fatal: [ubuntu22-latest]: FAILED! => {"assertion": "runner_name in registered_runners.json.runners|map(attribute='name')|list", "changed": false, "evaluated_to": false, "msg": "Assertion failed"}

PLAY RECAP *********************************************************************
ubuntu22-latest            : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Interestingly, there's a similar line in the default scenario's verify.yaml but this doesn't cause an error because it doesn't check the runners by name. This seems to be a change introduced in this commit.

@MonolithProjects
Copy link
Owner

I think the custom_env test scenario is broken because the verify.yaml stage is expecting to find a runner called ubuntu16-latest but this is not specified at the converge.yaml stage so defaults to the hostname (ubuntu22-latest) .

This results in an error
Interestingly, there's a similar line in the default scenario's verify.yaml but this doesn't cause an error because it doesn't check the runners by name. This seems to be a change introduced in this commit.

Thx @lewismiddleton. That will be probably just some leftovers from my testing. I will look on it.

Copy link
Owner

@MonolithProjects MonolithProjects left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@MonolithProjects MonolithProjects merged commit b95b43c into MonolithProjects:master May 24, 2024
4 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Related to Github Actions Workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants