Skip to content

Commit e9b8432

Browse files
Rteco alpine tests (#3590)
* RTECO-945 - Add CI workflow to run Alpine APK tests
1 parent e187bbf commit e9b8432

8 files changed

Lines changed: 151 additions & 2 deletions

File tree

.github/workflows/apkTests.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Alpine APK Tests
2+
on:
3+
workflow_call:
4+
inputs:
5+
jfrog_url:
6+
description: "External JFrog Platform URL. Leave empty for local Artifactory."
7+
type: string
8+
required: false
9+
default: ""
10+
jfrog_admin_token:
11+
description: "Admin token for external JFrog Platform."
12+
type: string
13+
required: false
14+
default: ""
15+
jfrog_user:
16+
description: "Username for external JFrog Platform."
17+
type: string
18+
required: false
19+
default: ""
20+
jfrog_password:
21+
description: "Password for external JFrog Platform."
22+
type: string
23+
required: false
24+
default: ""
25+
workflow_dispatch:
26+
inputs:
27+
jfrog_url:
28+
description: "External JFrog Platform URL. Leave empty for local Artifactory."
29+
type: string
30+
required: false
31+
default: ""
32+
jfrog_admin_token:
33+
description: "Admin token for external JFrog Platform."
34+
type: string
35+
required: false
36+
default: ""
37+
jfrog_user:
38+
description: "Username for external JFrog Platform."
39+
type: string
40+
required: false
41+
default: ""
42+
jfrog_password:
43+
description: "Password for external JFrog Platform."
44+
type: string
45+
required: false
46+
default: ""
47+
48+
jobs:
49+
Apk-Tests:
50+
name: Alpine APK tests (${{ matrix.alpine-version }})
51+
runs-on: ubuntu-24.04
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
alpine-version:
56+
- v3.18
57+
- v3.19
58+
- v3.20
59+
- v3.21
60+
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v6
64+
with:
65+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
66+
67+
- name: Setup FastCI
68+
uses: jfrog-fastci/fastci@v1
69+
with:
70+
github_token: ${{ secrets.GITHUB_TOKEN }}
71+
fastci_otel_token: ${{ secrets.FASTCI_TOKEN }}
72+
73+
- name: Setup Go with cache
74+
uses: jfrog/.github/actions/install-go-with-cache@main
75+
76+
# Only start a local Artifactory when no external platform is supplied.
77+
# When jfrog_url is provided the tests point directly at that instance
78+
# and there is no need to spin up Docker.
79+
- name: Install local Artifactory
80+
if: inputs.jfrog_url == ''
81+
uses: jfrog/.github/actions/install-local-artifactory@main
82+
with:
83+
RTLIC: ${{ secrets.RTLIC }}
84+
RT_CONNECTION_TIMEOUT_SECONDS: '1200'
85+
86+
# Set up an Alpine Linux chroot on the Ubuntu runner.
87+
# Steps that use `shell: alpine.sh {0}` run inside this chroot,
88+
# giving native access to the `apk` binary without a Docker container.
89+
- name: Setup Alpine environment
90+
uses: jirutka/setup-alpine@v1
91+
with:
92+
branch: ${{ matrix.alpine-version }}
93+
# go — required to compile and run the test suite inside Alpine
94+
# git — required by the Go toolchain for module downloads
95+
packages: go git
96+
97+
- name: Run Alpine APK tests
98+
shell: alpine.sh {0}
99+
run: |
100+
go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.alpine \
101+
${{ inputs.jfrog_url != '' && format('--jfrog.url={0} --jfrog.adminToken={1}', inputs.jfrog_url, inputs.jfrog_admin_token) || '' }} \
102+
${{ inputs.jfrog_user != '' && format('--jfrog.user={0}', inputs.jfrog_user) || '' }} \
103+
${{ inputs.jfrog_password != '' && format('--jfrog.password={0}', inputs.jfrog_password) || '' }}
104+
env:
105+
CGO_ENABLED: "0"

.github/workflows/build-gate.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ jobs:
109109
needs: gate
110110
uses: ./.github/workflows/nixTests.yml
111111
secrets: inherit
112+
alpine:
113+
needs: gate
114+
uses: ./.github/workflows/apkTests.yml
115+
secrets: inherit
112116
npm:
113117
needs: gate
114118
uses: ./.github/workflows/npmTests.yml
@@ -183,6 +187,7 @@ jobs:
183187
- lifecycle
184188
- maven
185189
- nix
190+
- alpine
186191
- npm
187192
- nuget
188193
- oidc

main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func setupIntegrationTests() {
7777
InitArtifactoryTests()
7878
}
7979

80-
if *tests.TestNpm || *tests.TestPnpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || *tests.TestUv || *tests.TestNix || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
80+
if *tests.TestNpm || *tests.TestPnpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || *tests.TestUv || *tests.TestNix || *tests.TestAlpine || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
8181
InitBuildToolsTests()
8282
}
8383
if *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan {
@@ -122,7 +122,7 @@ func tearDownIntegrationTests() {
122122
if (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
123123
CleanArtifactoryTests()
124124
}
125-
if *tests.TestNpm || *tests.TestPnpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || *tests.TestNix || *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
125+
if *tests.TestNpm || *tests.TestPnpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestConan || *tests.TestHelm || *tests.TestNix || *tests.TestAlpine || *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan || (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject {
126126
CleanBuildToolsTests()
127127
}
128128
if *tests.TestDistribution {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"key": "${ALPINE_LOCAL_REPO}",
3+
"rclass": "local",
4+
"packageType": "alpine"
5+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"key": "${ALPINE_REMOTE_REPO}",
3+
"rclass": "remote",
4+
"packageType": "alpine",
5+
"url": "https://dl-cdn.alpinelinux.org/alpine"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"key": "${ALPINE_VIRTUAL_REPO}",
3+
"rclass": "virtual",
4+
"packageType": "alpine",
5+
"repositories": ["${ALPINE_LOCAL_REPO}", "${ALPINE_REMOTE_REPO}"]
6+
}

utils/tests/consts.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ const (
108108
NixLocalRepositoryConfig = "nix_local_repository_config.json"
109109
NixRemoteRepositoryConfig = "nix_remote_repository_config.json"
110110
NixVirtualRepositoryConfig = "nix_virtual_repository_config.json"
111+
AlpineLocalRepositoryConfig = "alpine_local_repository_config.json"
112+
AlpineRemoteRepositoryConfig = "alpine_remote_repository_config.json"
113+
AlpineVirtualRepositoryConfig = "alpine_virtual_repository_config.json"
111114
PoetryLocalRepositoryConfig = "poetry_local_repository_config.json"
112115
PoetryRemoteRepositoryConfig = "poetry_remote_repository_config.json"
113116
PoetryVirtualRepositoryConfig = "poetry_virtual_repository_config.json"
@@ -217,6 +220,9 @@ var (
217220
NixLocalRepo = "cli-nix-local"
218221
NixRemoteRepo = "cli-nix-remote"
219222
NixVirtualRepo = "cli-nix-virtual"
223+
AlpineLocalRepo = "cli-alpine-local"
224+
AlpineRemoteRepo = "cli-alpine-remote"
225+
AlpineVirtualRepo = "cli-alpine-virtual"
220226
PoetryLocalRepo = "cli-poetry-local"
221227
PoetryRemoteRepo = "cli-poetry-remote"
222228
PoetryVirtualRepo = "cli-poetry-virtual"
@@ -266,6 +272,7 @@ var (
266272
UvBuildName = "cli-uv-build"
267273
AgentPluginsBuildName = "cli-agent-plugins-build"
268274
NixBuildName = "cli-nix-build"
275+
AlpineBuildName = "cli-alpine-build"
269276
ConanBuildName = "cli-conan-build"
270277
HelmBuildName = "cli-helm-build"
271278
HuggingFaceBuildName = "cli-huggingface-build"

utils/tests/utils.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ var (
7171
TestPoetry *bool
7272
TestUv *bool
7373
TestNix *bool
74+
TestAlpine *bool
7475
TestAgentPlugins *bool
7576
TestConan *bool
7677
TestHelm *bool
@@ -139,6 +140,7 @@ func init() {
139140
TestPoetry = flag.Bool("test.poetry", false, "Test Poetry")
140141
TestUv = flag.Bool("test.uv", false, "Test UV")
141142
TestNix = flag.Bool("test.nix", false, "Test Nix")
143+
TestAlpine = flag.Bool("test.alpine", false, "Test Alpine APK")
142144
TestAgentPlugins = flag.Bool("test.agentPlugins", false, "Test Agent Plugins")
143145
TestConan = flag.Bool("test.conan", false, "Test Conan")
144146
TestHelm = flag.Bool("test.helm", false, "Test Helm")
@@ -326,6 +328,9 @@ var reposConfigMap = map[*string]string{
326328
&NixLocalRepo: NixLocalRepositoryConfig,
327329
&NixRemoteRepo: NixRemoteRepositoryConfig,
328330
&NixVirtualRepo: NixVirtualRepositoryConfig,
331+
&AlpineLocalRepo: AlpineLocalRepositoryConfig,
332+
&AlpineRemoteRepo: AlpineRemoteRepositoryConfig,
333+
&AlpineVirtualRepo: AlpineVirtualRepositoryConfig,
329334
&ConanLocalRepo: ConanLocalRepositoryConfig,
330335
&ConanRemoteRepo: ConanRemoteRepositoryConfig,
331336
&ConanVirtualRepo: ConanVirtualRepositoryConfig,
@@ -398,6 +403,7 @@ func GetNonVirtualRepositories() map[*string]string {
398403
TestPoetry: {&PoetryLocalRepo, &PoetryRemoteRepo},
399404
TestUv: {&UvLocalRepo, &UvRemoteRepo},
400405
TestNix: {&NixLocalRepo, &NixRemoteRepo},
406+
TestAlpine: {&AlpineLocalRepo, &AlpineRemoteRepo},
401407
TestAgentPlugins: {&AgentPluginsLocalRepo},
402408
TestConan: {&ConanLocalRepo, &ConanRemoteRepo},
403409
TestHelm: {&HelmLocalRepo},
@@ -431,6 +437,7 @@ func GetVirtualRepositories() map[*string]string {
431437
TestPoetry: {&PoetryVirtualRepo},
432438
TestUv: {&UvVirtualRepo},
433439
TestNix: {&NixVirtualRepo},
440+
TestAlpine: {&AlpineVirtualRepo},
434441
TestAgentPlugins: {},
435442
TestConan: {&ConanVirtualRepo},
436443
TestHelm: {},
@@ -475,6 +482,7 @@ func GetBuildNames() []string {
475482
TestPoetry: {&PoetryBuildName},
476483
TestUv: {&UvBuildName},
477484
TestNix: {&NixBuildName},
485+
TestAlpine: {&AlpineBuildName},
478486
TestAgentPlugins: {&AgentPluginsBuildName},
479487
TestConan: {&ConanBuildName},
480488
TestHelm: {&HelmBuildName},
@@ -543,6 +551,9 @@ func getSubstitutionMap() map[string]string {
543551
"${NIX_LOCAL_REPO}": NixLocalRepo,
544552
"${NIX_REMOTE_REPO}": NixRemoteRepo,
545553
"${NIX_VIRTUAL_REPO}": NixVirtualRepo,
554+
"${ALPINE_LOCAL_REPO}": AlpineLocalRepo,
555+
"${ALPINE_REMOTE_REPO}": AlpineRemoteRepo,
556+
"${ALPINE_VIRTUAL_REPO}": AlpineVirtualRepo,
546557
"${CONAN_LOCAL_REPO}": ConanLocalRepo,
547558
"${CONAN_REMOTE_REPO}": ConanRemoteRepo,
548559
"${CONAN_VIRTUAL_REPO}": ConanVirtualRepo,
@@ -620,6 +631,9 @@ func AddTimestampToGlobalVars() {
620631
NixLocalRepo += uniqueSuffix
621632
NixRemoteRepo += uniqueSuffix
622633
NixVirtualRepo += uniqueSuffix
634+
AlpineLocalRepo += uniqueSuffix
635+
AlpineRemoteRepo += uniqueSuffix
636+
AlpineVirtualRepo += uniqueSuffix
623637
ConanLocalRepo += uniqueSuffix
624638
ConanRemoteRepo += uniqueSuffix
625639
ConanVirtualRepo += uniqueSuffix
@@ -654,6 +668,7 @@ func AddTimestampToGlobalVars() {
654668
AgentPluginsBuildName += uniqueSuffix
655669
UvBuildName += uniqueSuffix
656670
NixBuildName += uniqueSuffix
671+
AlpineBuildName += uniqueSuffix
657672
ConanBuildName += uniqueSuffix
658673
HelmBuildName += uniqueSuffix
659674
HuggingFaceBuildName += uniqueSuffix

0 commit comments

Comments
 (0)