Skip to content

RTECO-945: Wire jf apk commands and e2e tests - #3561

Open
naveenku-jfrog wants to merge 5 commits into
masterfrom
RTECO-alpine
Open

RTECO-945: Wire jf apk commands and e2e tests#3561
naveenku-jfrog wants to merge 5 commits into
masterfrom
RTECO-alpine

Conversation

@naveenku-jfrog

@naveenku-jfrog naveenku-jfrog commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Wires the Alpine APK integration into the JFrog CLI frontend: registers jf apk subcommands, adds CLI flags, package aliasing (Ghost Frog), and a comprehensive e2e test suite. This is the user-facing entry point for the full Alpine APK feature.

Depends on:


What Changed

buildtools/cli.go

  • ApkCmd() — dispatches jf apk config, jf apk upload, and all native apk subcommands (add, upgrade, etc.)
  • Extracts JFrog-specific flags (--repo, --server-id, --alpine-version, --user, --password, --build-name, --build-number, --module, --project) before forwarding remaining args to native apk
  • Fail-fast on unknown --server-id: if --server-id is explicitly provided but not found in the config, the command errors immediately — consistent with jf npm, jf pip, jf mvn, etc.
  • Falls back to the default server silently when --server-id is omitted (allows jf apk add to work without Artifactory for basic usage)

utils/cliutils/commandsflags.go

  • New Apk flag group: --repo, --server-id, --alpine-version, --user, --password, --build-name, --build-number, --module, --project

docs/buildtools/apkcommand/help.go

  • GetDescription(), GetAIDescription(), Usage, GetArguments() for jf apk help text and AI help coverage

packagealias/packagealias.go

  • Registers apk as a Ghost Frog package alias so jf apk add curl works identically to jfrog apk add curl — consistent with npm, pip, mvn, etc.

apk_test.go

Full end-to-end test suite (35 test cases) covering:

Category Tests
Basic build-info NoBuildFlags, WithBuildFlags, BuildNameFromEnvVars
Dependency collection DepIDFormat, DepChecksums, DepRequestedBy, TransitiveDeps
Scopes ScopeProduction, ScopeTransitive
Repo / server config MissingRepo, InvalidRepo, UnknownServerID, ArtifactoryUnreachable, VirtualRepoAggregates
Upload Upload, UploadWithBuildInfo, CIVCSPropertiesStamped
Config Config, ConfigMissingServerID
Env vars EnvVarsFiltered, EnvVarsIncluded
Multi-package MultiPackageInstall, MultiPackageBuildInfo
Idempotency IdempotentAdd
Error handling ApkBinaryMissing

.github/workflows/apkTests.yml

CI workflow that runs all TestApk* tests against a matrix of Alpine versions (v3.18, v3.19, v3.20, v3.21):

  • Compiles the test binary on ubuntu-24.04 (where Go 1.26 is available)
  • Runs the pre-built static binary inside each alpine:<version> Docker container to get a real apk binary
  • Spins up a local Artifactory instance via install-local-artifactory
  • Triggered via workflow_call and workflow_dispatch

scripts/test-apk-local.sh

Helper script for running Alpine APK e2e tests locally on macOS via Docker (mounts the repo and ~/.jfrog config into a golang:alpine container).


Design Notes

--repo is optional: Consistent with jf npm install and jf pip install, omitting --repo does not block build-info collection. Checksums are always available from the APK database (C: field). AQL enrichment (for SHA-256/MD5) is skipped when no repo is specified.

Test infrastructure: Tests require the apk binary (Alpine Linux). The workflow compiles a static Linux binary on the host and runs it inside Alpine Docker containers, avoiding Go version constraints in Alpine package repos.

AI help coverage: jf apk is wired through corecommon.ResolveDescription to satisfy the TestAIHelpCoverageGenerated check.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@naveenku-jfrog naveenku-jfrog changed the title Rteco alpine RTECO-945: Wire jf apk commands and e2e tests Jul 14, 2026
Comment thread buildtools/cli.go Outdated
Comment thread buildtools/cli.go Outdated
Comment thread .github/workflows/apkTests.yml
Comment thread apk_test.go
Comment thread apk_test.go Outdated
Comment thread apk_test.go
Comment thread apk_test.go Outdated
Comment thread docs/buildtools/apkcommand/help.go Outdated
Comment thread utils/cliutils/commandsflags.go Outdated
Wires the Alpine APK integration into the jf CLI:

- buildtools/cli.go, packagealias, utils/cliutils/commandsflags.go: register
  the jf apk command and its flags, routing to the apk command implemented in
  jfrog-cli-artifactory.
- docs/buildtools/apkcommand: help text for jf apk.
- apk_test.go, .github/workflows/apkTests.yml: end-to-end tests that install
  apk packages from an Artifactory repo and assert the collected Build Info
  (dependencies, checksums, scopes, transitive graph), plus the CI workflow.
- go.mod: bump build-info-go, jfrog-cli-core and jfrog-cli-artifactory to the
  commits carrying the Alpine implementation.

Co-authored-by: Cursor <cursoragent@cursor.com>
…y setup apk

setup apk deliberately only appends the Artifactory repo line and never
removes or rewrites existing /etc/apk/repositories entries (public
mirrors included), matching jfrog-cli-artifactory's apkMergeRepositoriesContent.
The test wrongly asserted every non-comment line had to be Artifactory-only,
which contradicted that append-only design and failed against a stock
Alpine image's default mirrors.
Points at the commit that skips --repo validation for apk add/upgrade
when no server is configured, so TestApkAdd_InvalidRepo exercises the
fix.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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.

2 participants