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

PIPE-4877 Remove config validate test with invalid org ID #1069

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

liamclarkedev
Copy link
Contributor

Checklist

=========

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked for similar issues and haven't found anything relevant.
  • This is not a security issue (which should be reported here: https://circleci.com/security/)
  • I have read Contribution Guidelines.

Internal Checklist

  • I am requesting a review from my own team as well as the owning team
  • I have a plan in place for the monitoring of the changes that I am making (this can include new monitors, logs to be aware of, etc...)

Changes

=======

  • Remove config validate test with invalid org ID

Rationale

=========

There has been a change to how configs are compiled that makes this test invalid.

Previously we would allow any random owner ID to be passed in when compiling certified orbs as these were enabled by default and didn't require any checks with the provided owner ID.

To support an upcoming feature, now when compiling the config, all provided owner IDs are checked and must exist to validate that the organization allows that type of orb.

The CLI can continue to use no owner ID with public certified orbs as tested in the above case.

Scenario: Checking a valid config file with an orb
Given a file named "config.yml" with:
"""
version: 2.1
orbs:
node: circleci/node@5.0.3
jobs:
datadog-hello-world:
docker:
- image: cimg/base:stable
steps:
- run: |
echo "doing something really cool"
workflows:
datadog-hello-world:
jobs:
- datadog-hello-world
"""
When I run `circleci config validate --skip-update-check -c config.yml`
Then the exit status should be 0
And the output should contain "Config file at config.yml is valid"

Considerations

==============

An alternative we can consider is to provide a valid private test organization ID to satisfy the test case, I opted against this since the config being compiled only uses a public certified orb which has the same behaviour with or without the owner ID.

Screenshots

============

Before

Image or [gif](https://giphy.com/apps/giphycapture)

After

Image or gif where change can be clearly seen

Here are some helpful tips you can follow when submitting a pull request:

  1. Fork the repository and create your branch from main.
  2. Run make build in the repository root.
  3. If you've fixed a bug or added code that should be tested, add tests!
  4. Ensure the test suite passes (make test).
  5. The --debug flag is often helpful for debugging HTTP client requests and responses.
  6. Format your code with gofmt.
  7. Make sure your code lints (make lint). Note: This requires Docker to run inside a local job.

There has been a change to how configs are compiled that makes this test
invalid.

Previously we would allow any random owner ID to be passed in
when compiling certified orbs as these were enabled by default and
didn't require any checks with the provided owner ID.

To support an upcoming feature, now when compiling the config, all
provided owner IDs are checked and must exist to validate that the
organization allows that type of orb.

The CLI can continue to use no owner ID with public certified orbs as
tested in the above case.

https://github.com/CircleCI-Public/circleci-cli/blob/2766f0e710c8727e346e247f6c779079a79b010c/integration_tests/features/circleci_config.feature#L63-L85
@liamclarkedev liamclarkedev requested a review from a team August 22, 2024 08:43
@liamclarkedev liamclarkedev requested a review from a team as a code owner August 22, 2024 08:43
@liamclarkedev liamclarkedev merged commit bb4017f into develop Aug 22, 2024
1 check passed
@liamclarkedev liamclarkedev deleted the pipe-4877/fix-config-validate-test branch August 22, 2024 13:10
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.

4 participants