Skip to content

Conversation

nipunn1313
Copy link

@nipunn1313 nipunn1313 commented Sep 8, 2025

Description

Fix the UI link to show the appropriate namespace

Example here of "old" behavior, where it was incorrectly showing default namespace.

% nomad run ../services/big-brain/pre-pull-images.nomad
Job registration successful

==> View this job in the Web UI: https://nomad.prod.cvx.is:443/ui/jobs/pre-pull-big-brain@default

Testing & Reproduction steps

nomad run something not in the default namespace

Links

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad website documentation to reflect this. Refer to
    the website README for docs guidelines. Please also consider whether the
    change requires notes within the upgrade guide.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.
  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

@nipunn1313 nipunn1313 requested review from a team as code owners September 8, 2025 21:19
Copy link

hashicorp-cla-app bot commented Sep 8, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

Comment on lines -311 to +313
jobNamespace := c.Meta.namespace
if jobNamespace == "" {
jobNamespace = "default"
jobNamespace := "default"
if job.Namespace != nil && *job.Namespace != "" {
jobNamespace = *job.Namespace
Copy link
Member

Choose a reason for hiding this comment

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

heya @nipunn1313, thanks for the PR!

I believe this resolves the issue for jobs that have namespace defined within the job specification, but it's also possible to specify the namespace on the CLI:

nomad job run -namespace='some-other-ns' job.nomad.hcl

which is what c.Meta.namespace reflects, so I think this change breaks that case.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah - I'm realizing we probably want to prioritize the CLI and then if CLI is missing - use the namespace within the job specification.


// TestRunCommand_NamespaceInUILink tests that the UI link uses the job's namespace
// rather than the CLI namespace when they differ.
func TestRunCommand_NamespaceInUILink(t *testing.T) {
Copy link
Author

Choose a reason for hiding this comment

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

This test is actually writing to nomad - I don't think this is what we want - going to remove it.

@tgross tgross moved this from Needs Triage to Triaging in Nomad - Community Issues Triage Sep 12, 2025
@tgross tgross self-assigned this Sep 12, 2025
@tgross tgross assigned gulducat and unassigned tgross Sep 12, 2025
@tgross tgross moved this from Triaging to In Progress in Nomad - Community Issues Triage Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants