EPMDEDP-17357: feat: Add auth status contract, Argo CD diagnostics, project versions - #41
Merged
Merged
Conversation
geekhubuser
force-pushed
the
EPMDEDP-17357
branch
from
September 22, 2026 10:09
f357d82 to
0481929
Compare
SergK
force-pushed
the
EPMDEDP-17357
branch
3 times, most recently
from
September 23, 2026 14:16
d0de056 to
a3d5c18
Compare
…roject versions - auth status exits 1 without a valid session and supports -o json. KRCI_TOKEN is validated by the portal; an expired JWT fails locally. - env get, project deployments, and deployment get/list report Argo CD conditions and operation, and Stage/CDPipeline detailedMessage. - New project versions lists image versions per branch from CodebaseImageStream. Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com> Co-authored-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
SergK
force-pushed
the
EPMDEDP-17357
branch
from
September 23, 2026 19:11
a3d5c18 to
a4a3cea
Compare
Member
|
/ok-to-test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
krci-overviewskill (EPMDEDP-17356) makes the CLI an agent's first tool on the platform, and writing it against the live CLI showed three places where the skill has to work around the CLI instead of using it. Each workaround is fragile and sends the agent tokubectl, which is unavailable for environments on remote clusters and outside the portal's RBAC.krci auth statusprintedNot authenticatedto stderr and exited0, for a missing and for an expired session alike, whiledocs/auth.mdalready promised a non-zero exit. The documented shell guard never fired and a script had to match stdout text. Now both cases exit1with the sentinel messages, and-o jsonreturns theschemaVersionenvelope:data.authenticated,data.user,data.name,data.groups(always an array),data.expiresAt(RFC3339 UTC ornull), orerror.messageon failure.env getandproject deploymentsfetched the full Argo CDApplicationbut mapped onlyhealthandsync, so an environment showedunknownwithout theComparisonErrorbehind it (unreachable target cluster, chart that fails to render,build/<version>revision that does not exist); the same forstatus.detailed_messageof a failedStageorCDPipeline. Now every project ofenv getand every row ofproject deploymentscarriesconditions[](type,message,lastTransitionTime; always an array) andoperation(phase,message,startedAt,finishedAt;nulluntil the first sync);env get,deployment get, its stages anddeployment listcarrydetailedMessage. Table mode prints aMessageline and aConditionsorMessagesblock only when there is something to show. Existing fields and their absence rules are unchanged.CodebaseImageStreamresources. Newkrci project versions <project> [--branch <name>]lists them one row per branch (count, newest version, created, image) or, with--branch, one row per version newest first. The git branch name is resolved through the owningCodebaseBranch, so the output saysrelease/2.27, not the operator'srelease-2-27-<hash>. An unknown project isproject '<name>' not found(exit1); a project without streams is an empty result (exit0). JSON:data.project,data.streams[]withbranch,image,versions[].All three read through the
resources/listandresources/getroutes the CLI already uses, so no portal change and no vendored spec change; they work against any portal that serves today's verbs. Keeping the workarounds in the skill was rejected because the skill would then encode CLI quirks that every other consumer of-o jsonhits as well.Fixes EPMDEDP-17357
Type of change
The only behaviour change for existing callers is the
auth statusexit code, which the documentation already stated. Every JSON change is an added field.How Has This Been Tested?
Reproduced first: on the binary built from
main,krci auth statuswithout a session exited0; on this branch it exits1and, with-o json, writes the error envelope. Unit tests were written before the code for every change (pkg/cmd/auth/status,internal/portal/diagnostics_test.go,internal/portal/project_versions_test.go,pkg/cmd/env/get,pkg/cmd/deployment/get,pkg/cmd/project/versions);go test ./...,go buildandgolangci-lint runpass.Executed against the built binary, offline and then live against a portal with the developer role (read-only commands, every value checked against
kubectlon the same namespace):krci auth statuswithout a session, table and-o json1, message on stderr, error envelope on stdoutkrci auth statuswith a session, table and-o json0,data.user,data.groups,data.expiresAtmatch the tokenkrci project versionswith no argument,BAD_NAME,-o yaml, a 254-character--branch1with the tabled messagekrci env geton an environment with a failing Application (remote cluster)conditions[]andoperationequal the Application'sstatus.conditionsandstatus.operationState; the Conditions block lists theComparisonErrorand theErroroperationkrci env geton an environment whose seven Applications point at abuild/NaNrevisionoperation: nullkrci project deploymentsfor that projectconditionsandoperationkrci project versionsfor a project with 13 builds;--branchfor arelease/x.ybranchcreatedequal theCodebaseImageStreamandCodebaseBranchresources; unknown project exits1withproject '<name>' not foundChecklist
Screenshots (if appropriate)
N/A
Additional context
Docs:
docs/auth.md,docs/env.md,docs/deployment.md,docs/project.md,docs/json-schemas.md, README command tree. e2e:e2e/auth/test-cases.mdis new;e2e/envande2e/projectgain rows, placeholders and fixture examples.Follow-up in
KubeRocketCI/skillsonce this ships:krci-overviewdrops its stdout-matching session guard and stops sending agents tokubectlfor Argo CD failure reasons and image versions.Out of scope, each a separate decision: pod logs and events (need a portal REST route), deploy, promote and approve verbs, a generic
krci get <kind>, unifying the JSON envelope across the older verbs, and a portal version inkrci version.