Skip to content

Correct use of system-scoped tokens in CI#3064

Merged
EmilienM merged 2 commits intogophercloud:masterfrom
stephenfin:fix-scoping
May 28, 2024
Merged

Correct use of system-scoped tokens in CI#3064
EmilienM merged 2 commits intogophercloud:masterfrom
stephenfin:fix-scoping

Conversation

@stephenfin
Copy link
Copy Markdown
Contributor

@stephenfin stephenfin commented May 28, 2024

Per the commit message in the first commit here, we are currently seeing the following error messages in some baremetal jobs:

Authentication cannot be scoped to multiple targets. Pick one of: project, domain, trust, system or unscoped

The only reason these are not causing failures yet is because we're not setting errexit in the scripts. Once we do (as we're doing in #3046), we get failures.

The fix is unset any project- or domain-specific envvars once we detect we are using system-scoped tokens.

Edit: The fix is to set both configuration for both project- and system-scoped tokens but only after we've completed all of our OSC invocations, side-stepping the above issue.

We also run the whole script through shellcheck to prevent further issues like this creeping in.

@github-actions github-actions bot added the semver:patch No API change label May 28, 2024
@stephenfin
Copy link
Copy Markdown
Contributor Author

/cc @EmilienM @dtantsur This was the cause of the functional-baremetal failures in #3046.

EmilienM
EmilienM previously approved these changes May 28, 2024
Copy link
Copy Markdown
Contributor

@EmilienM EmilienM left a comment

Choose a reason for hiding this comment

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

Thanks

@coveralls
Copy link
Copy Markdown

coveralls commented May 28, 2024

Coverage Status

coverage: 78.696%. remained the same
when pulling b28bc4e on stephenfin:fix-scoping
into 930d18c on gophercloud:master.

@EmilienM
Copy link
Copy Markdown
Contributor

@dtantsur for review, please

We were setting OS_SYSTEM_SCOPE in some of the functional ironic tests.
This was resulting in the following errors when attempting to create
resources:

  Authentication cannot be scoped to multiple targets. Pick one of:
  project, domain, trust, system or unscoped

Unfortunately, because we weren't setting 'errexit' ('set -e') this
wasn't being noticed, but we can "correct" things now. I say "correct"
because, adding to the misfortune, how we fix this is technically
incorrect - you should have project-scoped configuration *or*
system-scoped, not both - but since we don't yet have the infrastructure
to switch between sets of auth info on a test-by-test basis, we need to
do a Bad Thing. Hopefully this will be a short-lived thing.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
@github-actions github-actions bot added semver:patch No API change and removed semver:patch No API change labels May 28, 2024
@stephenfin
Copy link
Copy Markdown
Contributor Author

stephenfin commented May 28, 2024

So the initial attempt at this failed CI because while some of our tests require system-scoped tokens, others require project-scoped tokens. I've removed some of the rework here and added a large TODO to stackenv highlighting an ongoing issue and the potential long-term resolution (tl;dr: we need to start using clouds.yaml) which is probably worth looking at. Hopefully this gets things working for now though...

@EmilienM EmilienM merged commit 09c5d7c into gophercloud:master May 28, 2024
@stephenfin stephenfin deleted the fix-scoping branch May 29, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver:patch No API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants