Skip to content

Rteco alpine tests#3590

Merged
naveenku-jfrog merged 8 commits into
masterfrom
RTECO-alpine-tests
Jul 8, 2026
Merged

Rteco alpine tests#3590
naveenku-jfrog merged 8 commits into
masterfrom
RTECO-alpine-tests

Conversation

@naveenku-jfrog

@naveenku-jfrog naveenku-jfrog commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator
  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • The pull request is targeting the master branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....

Add CI workflow for Alpine APK tests
Context
The Alpine APK integration (RTECO-945) is being implemented across three repositories. The jfrog-cli PR for that work includes 29 new e2e test cases covering all jf apk subcommands. This PR wires those tests into the CI gate so they run automatically on every PR before merge.

What this PR adds
.github/workflows/apkTests.yml — a new reusable workflow for the Alpine APK test suite.

The suite follows the same structure as every other test workflow in this repo (nixTests.yml, agentPluginsTests.yml, etc.):

Uses install-local-artifactory for Artifactory setup (supports both local and external platforms via jfrog_url / jfrog_admin_token inputs)
Supports workflow_call so the build gate can fan it out, and workflow_dispatch for manual runs
The one difference from other suites: the go test step runs inside a golang:alpine container. This is necessary because apk is Alpine Linux's package manager and is not natively available on standard GitHub runners (Ubuntu/macOS/Windows). The Go module and build caches from install-go-with-cache are mounted into the container so there are no duplicate downloads.

.github/workflows/build-gate.yml — wires the new apk suite into the single approval gate:

Added apk job that calls apkTests.yml behind the gate job
Added apk to the build-gate-success needs: list so the suite is a required status check before merge

naveenku-jfrog and others added 3 commits July 7, 2026 09:57
Co-authored-by: Cursor <cursoragent@cursor.com>
Replace explicit docker run step with GitHub Actions container: key.
The entire job now runs inside golang:alpine so `apk` is natively on
PATH. Artifactory is started as a service container alongside the job
and is reachable at http://artifactory:8081 — no docker commands needed
in any step.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@naveenku-jfrog naveenku-jfrog added feature request New feature or request safe to test Approve running integration tests on a pull request and removed feature request New feature or request labels Jul 7, 2026
These changes must land before the e2e test cases so the workflow
can compile and run cleanly (even with 0 tests) as soon as this PR
merges:

- utils/tests/consts.go: Alpine repo config filenames, repo key
  vars (AlpineLocalRepo/RemoteRepo/VirtualRepo), ApkBuildName.
- utils/tests/utils.go: TestApk flag declaration, repo maps for
  GetNonVirtualRepositories/GetVirtualRepositories, template var
  substitutions, and AddTimestampToGlobalVars entries.
- main_test.go: wire TestApk into InitBuildToolsTests() and
  CleanBuildToolsTests() so Alpine repos are created/deleted
  alongside other suites.
- testdata/alpine_{local,remote,virtual}_repository_config.json:
  JSON templates used by createRequiredRepos() to provision the
  Alpine repos in Artifactory.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread utils/tests/consts.go Outdated
UvBuildName = "cli-uv-build"
AgentPluginsBuildName = "cli-agent-plugins-build"
NixBuildName = "cli-nix-build"
ApkBuildName = "cli-apk-build"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: can we rename it to alpineBuildName, so as to be consistent and be more readable

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed

Comment thread utils/tests/utils.go Outdated
TestPoetry *bool
TestUv *bool
TestNix *bool
TestApk *bool

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed

Comment thread utils/tests/utils.go Outdated
TestPoetry = flag.Bool("test.poetry", false, "Test Poetry")
TestUv = flag.Bool("test.uv", false, "Test UV")
TestNix = flag.Bool("test.nix", false, "Test Nix")
TestApk = flag.Bool("test.apk", false, "Test Alpine APK")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed

Comment thread utils/tests/utils.go Outdated
TestPoetry: {&PoetryLocalRepo, &PoetryRemoteRepo},
TestUv: {&UvLocalRepo, &UvRemoteRepo},
TestNix: {&NixLocalRepo, &NixRemoteRepo},
TestApk: {&AlpineLocalRepo, &AlpineRemoteRepo},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed

Comment thread main_test.go
Comment thread .github/workflows/apkTests.yml
Comment thread .github/workflows/apkTests.yml Outdated
Comment on lines +60 to +78
- name: Run Alpine APK tests
# golang:alpine provides the native `apk` binary.
# --network host lets the container reach the Artifactory instance on localhost:8081.
# The Go module and build caches are mounted so the image reuses what
# install-go-with-cache already downloaded — no duplicate downloads.
run: |
docker run --rm \
--network host \
--user root \
-v "${{ github.workspace }}:/workspace" \
-v "${{ env.GOPATH }}/pkg/mod:/root/go/pkg/mod" \
-v "${{ env.GOCACHE }}:/root/.cache/go-build" \
-w /workspace \
-e CGO_ENABLED=0 \
-e GOPATH=/root/go \
-e GOCACHE=/root/.cache/go-build \
golang:alpine \
go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.apk \
${{ env.JFROG_TESTS_IS_EXTERNAL == 'true' && format('--jfrog.url={0} --jfrog.adminToken={1}', env.JFROG_TESTS_URL, env.JFROG_TESTS_LOCAL_ACCESS_TOKEN) || '' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

instead of manually setting this container, please try to use

  alpine-job:
    runs-on: ubuntu-latest  # The host VM
    container:
      image: alpine:latest  # The environment where your steps execute
    steps:
      - name: Verify OS
        run: cat /etc/alpine-release
      - name: Install Packages
        run: apk add --no-cache curl

or

  alpine-job:
    runs-on: ubuntu-latest
    steps:
      - name: Setup Alpine
        uses: jirutka/setup-alpine@v1
      - name: Run Alpine command
        shell: alpine.sh {0}
        run: |
          apk add git
          cat /etc/alpine-release```

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed it.

Comment thread .github/workflows/apkTests.yml Outdated
Comment on lines +77 to +78
go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.apk \
${{ env.JFROG_TESTS_IS_EXTERNAL == 'true' && format('--jfrog.url={0} --jfrog.adminToken={1}', env.JFROG_TESTS_URL, env.JFROG_TESTS_LOCAL_ACCESS_TOKEN) || '' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

also how the url and token input used here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

addressed it.

Comment thread .github/workflows/apkTests.yml
naveenku-jfrog added a commit that referenced this pull request Jul 7, 2026
- Rename TestApk → TestAlpine and ApkBuildName → AlpineBuildName for
  consistency with AlpineLocalRepo/RemoteRepo/VirtualRepo naming.
  CLI flag changes from -test.apk to -test.alpine accordingly.
- Add jfrog_user / jfrog_password inputs to apkTests.yml so callers
  can supply credentials alongside jfrog_url / jfrog_admin_token.
- Replace explicit docker run step with jirutka/setup-alpine@v1 so
  the apk binary is available via a native Alpine chroot on the Ubuntu
  runner without needing to manage Docker flags manually.

Co-authored-by: Cursor <cursoragent@cursor.com>
naveenku-jfrog added a commit that referenced this pull request Jul 7, 2026
Address PR #3590 review: rename test flag and build-name constant to
use 'Alpine' prefix for consistency with AlpineLocalRepo/RemoteRepo/VirtualRepo.
Also update skip message to reference '-test.alpine=true'.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Rename TestApk → TestAlpine and ApkBuildName → AlpineBuildName for
  consistency with AlpineLocalRepo/RemoteRepo/VirtualRepo naming.
  CLI flag changes from -test.apk to -test.alpine accordingly.
- Add jfrog_user / jfrog_password inputs to apkTests.yml so callers
  can supply credentials alongside jfrog_url / jfrog_admin_token.
- Replace explicit docker run step with jirutka/setup-alpine@v1 so
  the apk binary is available via a native Alpine chroot on the Ubuntu
  runner without needing to manage Docker flags manually.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread .github/workflows/build-gate.yml Outdated
Comment thread .github/workflows/build-gate.yml Outdated
Comment thread .github/workflows/apkTests.yml
Comment thread .github/workflows/apkTests.yml
- Rename apk → alpine job in build-gate.yml (job key and needs list)
  to be consistent with AlpineLocalRepo/RemoteRepo naming.
- Skip install-local-artifactory when external jfrog_url is supplied;
  there is no need to start a local Docker container in that case.
  The go test line now uses inputs.jfrog_url/jfrog_admin_token directly
  instead of relying on env vars set by the action.
- Add a matrix of Alpine versions (v3.18, v3.19, v3.20, v3.21) so the
  test suite runs against multiple supported Alpine releases, not just
  the latest.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

👍 Frogbot scanned this pull request and did not find any new security issues.


${{ inputs.jfrog_user != '' && format('--jfrog.user={0}', inputs.jfrog_user) || '' }} \
${{ inputs.jfrog_password != '' && format('--jfrog.password={0}', inputs.jfrog_password) || '' }}
env:
CGO_ENABLED: "0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: why do we need this? CGO specifically here? can we remove if not required

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

we do it in follow PR.

@naveenku-jfrog naveenku-jfrog merged commit e9b8432 into master Jul 8, 2026
191 of 193 checks passed
@naveenku-jfrog naveenku-jfrog deleted the RTECO-alpine-tests branch July 8, 2026 05:45
naveenku-jfrog added a commit that referenced this pull request Jul 8, 2026
* RTECO-945 - Add CI workflow to run Alpine APK tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request safe to test Approve running integration tests on a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants