RTECO-945: Wire jf apk commands and e2e tests - #3561
Conversation
7af2722 to
ac81485
Compare
18c3b05 to
89e6093
Compare
89e6093 to
7177b09
Compare
7177b09 to
bcfba32
Compare
ee511cf to
dcc6d06
Compare
7f9c899 to
213f8f6
Compare
0214c4f to
98397ae
Compare
|
All contributors have signed the CLA ✍️ ✅ |
1a9f22a to
0277d99
Compare
b994bb9 to
c488334
Compare
8c534d2 to
a0db8ca
Compare
a0db8ca to
db5e2a4
Compare
- Wire jf apk add/upgrade/upload/update and jf setup apk into the CLI - Add Alpine APK e2e tests: build-info, release-bundle creation, build-promote, arch auto-detect from .PKGINFO, indexable-path layout - Add selective-retry e2e runner script and apk-tools v2/v3 CI matrix - Bump build-info-go, jfrog-cli-core, jfrog-cli-artifactory to Alpine builds Co-authored-by: Cursor <cursoragent@cursor.com>
Consume the Artifactory implementation that validates explicit APK repository selections before execution.
| $creds 2>&1 | tee /tmp/apk-out.log | ||
|
|
||
| # Collect the top-level names of tests that failed this attempt. | ||
| fails=$(grep -Eo '^--- FAIL: [A-Za-z0-9_]+' /tmp/apk-out.log | awk '{print $3}' | sort -u | tr '\n' '|' | sed 's/|$//') |
There was a problem hiding this comment.
This only checks for literal --- FAIL: lines in the captured output — it doesn't check docker run's own exit code. If the test binary crashes/panics or the container gets OOM-killed before printing any --- FAIL: line, $fails stays empty and the step reports "All Alpine tests passed" on that attempt. Might be worth capturing ${PIPESTATUS[0]} (or splitting the pipe) and treating a non-zero docker exit as a failure too.
|
|
||
| // TestApkAdd_ArtifactoryUnreachable verifies that when Artifactory is unreachable | ||
| // jf apk add returns a clear error and does not silently fall back to the public CDN. | ||
| func TestApkAdd_ArtifactoryUnreachable(t *testing.T) { |
There was a problem hiding this comment.
This test body is identical to TestApkAdd_UnknownServerID above (same --server-id=nonexistent-server-id-xyz args) — it doesn't actually simulate an unreachable Artifactory server, it just re-tests the unknown-server-id path. Should this point at a real unreachable host/port instead (e.g. an invalid URL in a throwaway server config) to cover the case the name describes?
| } | ||
| } | ||
| } | ||
| assert.True(t, hasProd, "at least one dependency should have scope 'prod'") |
There was a problem hiding this comment.
hasTransitive is computed but only logged at line 468-469, never asserted. Given the comment above says curl reliably brings in transitive deps (libcurl, musl, etc.), should this be assert.True(t, hasTransitive, ...) like the hasProd check right above it, rather than just a log line?
- Intercept `help`/`-h` so `jf apk help` and `jf apk upload -h` print CLI help and exit 0 instead of forwarding to native apk - Resolve server details via resolveApkServerDetails with excludeRefreshableTokens so persistent apk config avoids short-lived tokens; guard SetServerDetails against a nil server - Document build-info vs passthrough subcommands and per-subcommand flags; make --branch apk-specific - Harden the Alpine CI retry loop against container-level failures Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve conflicts: - buildtools/cli.go: keep the alpine command import alongside conan/nix - go.mod/go.sum: keep the Alpine build-info-go (c384608) required by the alpine cli-core/artifactory/client versions; take master froggit-go v1.23.1 Co-authored-by: Cursor <cursoragent@cursor.com>

Summary
Wires the Alpine APK integration into the JFrog CLI frontend: registers
jf apksubcommands, 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.goApkCmd()— dispatchesjf apk config,jf apk upload, and all nativeapksubcommands (add,upgrade, etc.)--repo,--server-id,--alpine-version,--user,--password,--build-name,--build-number,--module,--project) before forwarding remaining args to nativeapk--server-id: if--server-idis explicitly provided but not found in the config, the command errors immediately — consistent withjf npm,jf pip,jf mvn, etc.--server-idis omitted (allowsjf apk addto work without Artifactory for basic usage)utils/cliutils/commandsflags.goApkflag group:--repo,--server-id,--alpine-version,--user,--password,--build-name,--build-number,--module,--projectdocs/buildtools/apkcommand/help.goGetDescription(),GetAIDescription(),Usage,GetArguments()forjf apkhelp text and AI help coveragepackagealias/packagealias.goapkas a Ghost Frog package alias sojf apk add curlworks identically tojfrog apk add curl— consistent withnpm,pip,mvn, etc.apk_test.goFull end-to-end test suite (35 test cases) covering:
NoBuildFlags,WithBuildFlags,BuildNameFromEnvVarsDepIDFormat,DepChecksums,DepRequestedBy,TransitiveDepsScopeProduction,ScopeTransitiveMissingRepo,InvalidRepo,UnknownServerID,ArtifactoryUnreachable,VirtualRepoAggregatesUpload,UploadWithBuildInfo,CIVCSPropertiesStampedConfig,ConfigMissingServerIDEnvVarsFiltered,EnvVarsIncludedMultiPackageInstall,MultiPackageBuildInfoIdempotentAddApkBinaryMissing.github/workflows/apkTests.ymlCI workflow that runs all
TestApk*tests against a matrix of Alpine versions (v3.18,v3.19,v3.20,v3.21):ubuntu-24.04(where Go 1.26 is available)alpine:<version>Docker container to get a realapkbinaryinstall-local-artifactoryworkflow_callandworkflow_dispatchscripts/test-apk-local.shHelper script for running Alpine APK e2e tests locally on macOS via Docker (mounts the repo and
~/.jfrogconfig into agolang:alpinecontainer).Design Notes
--repois optional: Consistent withjf npm installandjf pip install, omitting--repodoes 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
apkbinary (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 apkis wired throughcorecommon.ResolveDescriptionto satisfy theTestAIHelpCoverageGeneratedcheck.