Skip to content

Commit fa4318f

Browse files
authored
Merge pull request #2 from aerospike/dev/SERVER-459
2 parents d413d85 + 78d9c7e commit fa4318f

18 files changed

+312
-79
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Server Packaging Common
1+
# Tools Packaging Common
22

33
This repository contains common scripts and files for packaging Aerospike Tools
44

@@ -30,7 +30,7 @@ You must have
3030

3131
cd (your repository)
3232
mkdir -p .github/packaging/project
33-
git submodule add https://github.com/aerospike/server-packaging-common.git .github/packaging/common
33+
git submodule add https://github.com/aerospike/tools-packaging-common.git .github/packaging/common
3434
cp -a .github/packaging/common/project-example/* .github/packaging/project/
3535
# edit .github/packaging/project/* to match your project
3636
mkdir pkg
@@ -56,6 +56,8 @@ This repository should be setup in your project as follows:
5656
└── pkg/Makefile # Makefile for building the package
5757
```
5858

59+
![Github Actions Workflow](docs/img/gha-packaging-workflow.jpg)
60+
5961
## Contributing
6062

6163
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.

build-artifacts-example.yml

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ on:
77
workflow_dispatch:
88
push:
99
branches:
10-
# yamllint disable-line
10+
# yamllint disable-line rule:quoted-strings
1111
- "dev/*"
12-
# yamllint disable-line
12+
# yamllint disable-line rule:quoted-strings
1313
- "hotfix/*"
14+
# yamllint disable-line rule:quoted-strings
15+
- "main"
16+
# yamllint disable-line rule:quoted-strings
17+
- "master"
1418
tags:
1519
- "*"
1620

@@ -31,32 +35,23 @@ jobs:
3135
host:
3236
- ubuntu-24.04
3337
- ubuntu-24.04-arm
34-
uses: aerospike/shared-workflows/.github/workflows/[email protected].1
38+
uses: aerospike/shared-workflows/.github/workflows/[email protected].2
3539
with:
3640
runs-on: ${{ matrix.host }}
3741
jf-project: database
3842
jf-build-id: ${{ github.run_number }}
3943
# this is the default behaviour so we can leave it out but if it is wanted to be explicit
4044
# we need to use the ref not the ref_name in github actions. The ref_name is the short name and so not a valid ref.
4145
# gh-source-ref: ${{ github.ref }}
42-
build-script: |
43-
set -xeuo pipefail
44-
cd local
45-
git fetch --unshallow --tags --no-recurse-submodules
46-
git submodule update --init
47-
ls -laht
48-
echo ref_name ${{ github.ref_name }}
49-
git branch -v
50-
.github/packaging/common/entrypoint.sh -c -d ${{ matrix.distro }}
51-
.github/packaging/common/entrypoint.sh -e -d ${{ matrix.distro }}
52-
ls -laht ../dist
46+
build-script: local/.github/packaging/project/gha-main.sh "${{ matrix.distro }}"
47+
5348
gh-artifact-directory: dist
5449
gh-artifact-name: unsigned-artifacts-${{ matrix.distro }}-${{ matrix.host }}
5550
gh-retention-days: 1
5651
dry-run: false
5752
oidc-provider-name: database-gh-aerospike
5853
oidc-audience: database-gh-aerospike
59-
jf-build-name: asconfig
54+
jf-build-name: ${{ github.event.repository.name }}
6055
sign-artifacts:
6156
strategy:
6257
matrix:
@@ -74,15 +69,14 @@ jobs:
7469
- ubuntu-24.04
7570
- ubuntu-24.04-arm
7671
needs: build-artifacts
77-
uses: aerospike/shared-workflows/.github/workflows/[email protected].1
72+
uses: aerospike/shared-workflows/.github/workflows/[email protected].2
7873
with:
7974
gh-artifact-name: signed-artifacts-${{ matrix.distro }}-${{ matrix.host }}
8075
gh-unsigned-artifacts: unsigned-artifacts-${{ matrix.distro }}-${{ matrix.host }}
8176
secrets:
8277
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
8378
gpg-public-key: ${{ secrets.GPG_PUBLIC_KEY }}
8479
gpg-key-pass: ${{ secrets.GPG_PASS }}
85-
8680
upload-artifacts:
8781
strategy:
8882
matrix:
@@ -100,10 +94,10 @@ jobs:
10094
- ubuntu-24.04
10195
- ubuntu-24.04-arm
10296
needs: sign-artifacts
103-
uses: aerospike/shared-workflows/.github/workflows/[email protected].1
97+
uses: aerospike/shared-workflows/.github/workflows/[email protected].2
10498
with:
10599
jf-project: database
106-
jf-build-name: asconfig
100+
jf-build-name: ${{ github.event.repository.name }}
107101
version: ${{ github.ref_name }}
108102
oidc-provider-name: database-gh-aerospike
109103
oidc-audience: database-gh-aerospike
@@ -112,3 +106,50 @@ jobs:
112106
dry-run: false
113107
jf-build-id: ${{ github.run_number }}
114108
jf-metadata-build-id: ${{ github.run_number }}-metadata
109+
test-install-from-jfrog-and-execute:
110+
strategy:
111+
matrix:
112+
distro:
113+
- el8
114+
- el9
115+
- el10
116+
- amzn2023
117+
- debian12
118+
- debian13
119+
- ubuntu20.04
120+
- ubuntu22.04
121+
- ubuntu24.04
122+
host:
123+
- ubuntu-24.04
124+
- ubuntu-24.04-arm
125+
needs: upload-artifacts
126+
env:
127+
JFROG_CLI_BUILD_NAME: ${{ inputs.jf-build-name || github.workflow }}
128+
JFROG_CLI_LOG_LEVEL: INFO
129+
runs-on: ${{ matrix.host }}
130+
permissions:
131+
contents: read
132+
packages: write
133+
attestations: write
134+
id-token: write
135+
steps:
136+
- name: Install JFrog CLI
137+
id: jf
138+
uses: jfrog/setup-jfrog-cli@5b06f730cc5a6f55d78b30753f8583454b08c0aa # v4.8.1
139+
env:
140+
JF_URL: https://artifact.aerospike.io
141+
JF_PROJECT: database
142+
with:
143+
oidc-provider-name: database-gh-aerospike
144+
oidc-audience: database-gh-aerospike
145+
- name: Checkout
146+
uses: actions/checkout@v5
147+
with:
148+
ref: ${{ github.ref }}
149+
submodules: recursive
150+
151+
- name: Run test cases
152+
env:
153+
JF_TOKEN: ${{ steps.jf.outputs.oidc-token }}
154+
JF_USERNAME: ${{ steps.jf.outputs.oidc-user }}
155+
run: .github/packaging/project/test/gha-test-main.sh ${{ matrix.distro }} ${{ github.event.repository.name }}

build_container.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -xeuo pipefail
44

55
function build_container() {
6-
docker build \
6+
docker build --progress=plain \
77
--build-arg=BASE_IMAGE="${distro_to_image["$1"]}" \
88
--build-arg=ENV_DISTRO="$1" \
99
--build-arg=REPO_NAME="$REPO_NAME" \

docs/img/gha-packaging-flow.drawio

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36" version="28.2.9">
2+
<diagram name="Page-1" id="lyBkX14g1DaUT6RCE7dN">
3+
<mxGraphModel dx="960" dy="611" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0" />
6+
<mxCell id="1" parent="0" />
7+
<mxCell id="XKD21DTT9UFcApdLthT_-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="XKD21DTT9UFcApdLthT_-1" target="XKD21DTT9UFcApdLthT_-6">
8+
<mxGeometry relative="1" as="geometry" />
9+
</mxCell>
10+
<mxCell id="XKD21DTT9UFcApdLthT_-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="XKD21DTT9UFcApdLthT_-1" target="XKD21DTT9UFcApdLthT_-21">
11+
<mxGeometry relative="1" as="geometry" />
12+
</mxCell>
13+
<mxCell id="XKD21DTT9UFcApdLthT_-1" value="Github Action&lt;br&gt;build-artifacts.yml" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
14+
<mxGeometry x="130" y="50" width="120" height="60" as="geometry" />
15+
</mxCell>
16+
<mxCell id="XKD21DTT9UFcApdLthT_-2" value="" style="dashed=0;outlineConnect=0;html=1;align=center;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.weblogos.github" vertex="1" parent="1">
17+
<mxGeometry x="50" y="43" width="75" height="75" as="geometry" />
18+
</mxCell>
19+
<mxCell id="XKD21DTT9UFcApdLthT_-14" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="XKD21DTT9UFcApdLthT_-6" target="XKD21DTT9UFcApdLthT_-8">
20+
<mxGeometry relative="1" as="geometry" />
21+
</mxCell>
22+
<mxCell id="XKD21DTT9UFcApdLthT_-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="XKD21DTT9UFcApdLthT_-6" target="XKD21DTT9UFcApdLthT_-15">
23+
<mxGeometry relative="1" as="geometry" />
24+
</mxCell>
25+
<mxCell id="XKD21DTT9UFcApdLthT_-6" value="project/gha-main.sh&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
26+
<mxGeometry x="190" y="140" width="120" height="60" as="geometry" />
27+
</mxCell>
28+
<mxCell id="XKD21DTT9UFcApdLthT_-8" value="common/entrypoint.sh&lt;br&gt;-c -d $DISTRO" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
29+
<mxGeometry x="340" y="140" width="140" height="60" as="geometry" />
30+
</mxCell>
31+
<mxCell id="XKD21DTT9UFcApdLthT_-13" value="&lt;h1 style=&quot;text-align: center; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-size: 12px; font-weight: 400;&quot;&gt;Create docker image with necessary dependencies to compile the project&lt;/span&gt;&lt;/h1&gt;" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" vertex="1" parent="1">
32+
<mxGeometry x="500" y="145" width="230" height="50" as="geometry" />
33+
</mxCell>
34+
<mxCell id="XKD21DTT9UFcApdLthT_-15" value="common/entrypoint.sh&lt;br&gt;-e -d $DISTRO" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
35+
<mxGeometry x="340" y="220" width="140" height="60" as="geometry" />
36+
</mxCell>
37+
<mxCell id="XKD21DTT9UFcApdLthT_-16" value="&lt;h1 style=&quot;text-align: center; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-size: 12px; font-weight: 400;&quot;&gt;Execute the prepared builder image,&amp;nbsp;&lt;br&gt;will produce a deb or rpm in ../dist&lt;/span&gt;&lt;/h1&gt;" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" vertex="1" parent="1">
38+
<mxGeometry x="500" y="225" width="230" height="50" as="geometry" />
39+
</mxCell>
40+
<mxCell id="XKD21DTT9UFcApdLthT_-28" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="XKD21DTT9UFcApdLthT_-19" target="XKD21DTT9UFcApdLthT_-27">
41+
<mxGeometry relative="1" as="geometry" />
42+
</mxCell>
43+
<mxCell id="XKD21DTT9UFcApdLthT_-19" value="Sign and deploy to artifactory" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.layered_rect;dx=10;outlineConnect=0;whiteSpace=wrap;" vertex="1" parent="1">
44+
<mxGeometry x="200" y="300" width="100" height="60" as="geometry" />
45+
</mxCell>
46+
<mxCell id="XKD21DTT9UFcApdLthT_-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=25;entryPerimeter=0;" edge="1" parent="1" source="XKD21DTT9UFcApdLthT_-1" target="XKD21DTT9UFcApdLthT_-19">
47+
<mxGeometry relative="1" as="geometry" />
48+
</mxCell>
49+
<mxCell id="XKD21DTT9UFcApdLthT_-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="XKD21DTT9UFcApdLthT_-21" target="XKD21DTT9UFcApdLthT_-29">
50+
<mxGeometry relative="1" as="geometry" />
51+
</mxCell>
52+
<mxCell id="XKD21DTT9UFcApdLthT_-21" value="common/test/gha-main.sh&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
53+
<mxGeometry x="190" y="440" width="160" height="60" as="geometry" />
54+
</mxCell>
55+
<mxCell id="XKD21DTT9UFcApdLthT_-27" value="" style="sketch=0;html=1;aspect=fixed;strokeColor=none;shadow=0;fillColor=#3B8DF1;verticalAlign=top;labelPosition=center;verticalLabelPosition=bottom;shape=mxgraph.gcp2.repository_2" vertex="1" parent="1">
56+
<mxGeometry x="404.8" y="290" width="75.2" height="80" as="geometry" />
57+
</mxCell>
58+
<mxCell id="XKD21DTT9UFcApdLthT_-31" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="XKD21DTT9UFcApdLthT_-29" target="XKD21DTT9UFcApdLthT_-30">
59+
<mxGeometry relative="1" as="geometry" />
60+
</mxCell>
61+
<mxCell id="XKD21DTT9UFcApdLthT_-29" value="&lt;div&gt;common/example-test.sh $DISTRO $REPO_NAME&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
62+
<mxGeometry x="380" y="440" width="160" height="60" as="geometry" />
63+
</mxCell>
64+
<mxCell id="XKD21DTT9UFcApdLthT_-30" value="project/test/test_execute.bats" style="whiteSpace=wrap;html=1;rounded=0;" vertex="1" parent="1">
65+
<mxGeometry x="580" y="440" width="170" height="60" as="geometry" />
66+
</mxCell>
67+
<mxCell id="XKD21DTT9UFcApdLthT_-32" value="Execute test cases" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" vertex="1" parent="1">
68+
<mxGeometry x="610" y="510" width="130" height="50" as="geometry" />
69+
</mxCell>
70+
<mxCell id="XKD21DTT9UFcApdLthT_-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.394;entryY=0.017;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="XKD21DTT9UFcApdLthT_-27" target="XKD21DTT9UFcApdLthT_-29">
71+
<mxGeometry relative="1" as="geometry" />
72+
</mxCell>
73+
<mxCell id="XKD21DTT9UFcApdLthT_-34" value="Download and install artifacts from JFrog in test container" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" vertex="1" parent="1">
74+
<mxGeometry x="450" y="380" width="160" height="30" as="geometry" />
75+
</mxCell>
76+
<mxCell id="XKD21DTT9UFcApdLthT_-35" value="Requires credentials&lt;br&gt;$JF_USER&lt;br&gt;$JF_TOKEN" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" vertex="1" parent="1">
77+
<mxGeometry x="380" y="510" width="180" height="50" as="geometry" />
78+
</mxCell>
79+
</root>
80+
</mxGraphModel>
81+
</diagram>
82+
</mxfile>
51.8 KB
Loading

entrypoint.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ repo_to_package["aerospike-admin"]="asadm"
3939
repo_to_package["aerospike-benchmark"]="asbench"
4040
repo_to_package["aerospike-tools-backup"]="asbackup"
4141
repo_to_package["aql"]="aql"
42+
repo_to_package["aerospike-tools"]="tools"
43+
4244

4345
export PACKAGE_NAME=${repo_to_package["$REPO_NAME"]}
4446

@@ -85,13 +87,13 @@ shift $((OPTIND -1))
8587

8688
if [ "$INSTALL" = false ] && [ "$BUILD_INTERNAL" = false ] && [ "$BUILD_CONTAINERS" = false ] && [ "$EXECUTE_BUILD" = false ] && [ "$RUN_TESTS" = false ];
8789
then
88-
echo "Error: Options:
89-
-t ( test )
90-
-i ( install )
91-
-b ( build internal )
92-
-c ( build containers )
93-
-e ( execute docker package build )
94-
-d [ redhat | ubuntu | debian ]" 1>&2
90+
echo "Usage:
91+
-t ( run test cases )
92+
-i ( install dependencies )
93+
-b ( compile and package project )
94+
-c ( build container -d \$DISTRO )
95+
-e ( execute prepared builder image and produce artifact in ../dist/\$DISTRO )
96+
-d [ el8 el9 el10 amazon2023 debian12 debian13 ubuntu20.04 ubuntu22.04 ubuntu24.04 ]" 1>&2
9597
exit 1
9698
fi
9799
export ENV_DISTRO

example-build-package.sh

100644100755
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
DISTRO=${1:-"el9"}
23
# This repo is intended to be invoked on Linux with git and docker installed
34
# Your working directory should be the root of the git repository
45

@@ -11,11 +12,11 @@
1112

1213

1314
# To build the packaging container, use
14-
.github/packaging/common/entrypoint.sh -c -d el9
15+
.github/packaging/common/entrypoint.sh -c -d "$DISTRO"
1516

1617
# To execute the build, use
17-
.github/packaging/common/entrypoint.sh -e -d el9
18+
.github/packaging/common/entrypoint.sh -e -d "$DISTRO"
1819

1920
# This will produce packages in ../dist relative to your current working directory
20-
# $ ls ../dist/el9
21-
# aerospike-asconfig-0.19.0-173-gde57889.el9.aarch64.rpm
21+
# $ ls ../dist/$DISTRO
22+
# aerospike-asconfig-0.19.0-173-gde57889.$DISTRO.aarch64.rpm

example-test.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
#!/usr/bin/env bash
2+
DISTRO=${1:-"el9"}
3+
4+
GIT_REPO_NAME=$(git config --get remote.origin.url | rev | cut -d '.' -f 2 | rev | cut -d '/' -f 2)
5+
REPO_NAME=${2:-"$GIT_REPO_NAME"}
6+
7+
set -x
28
# You can execute this README by replacing the following with your email and your JFrog token:
39
# JF_USERNAME='[email protected]' JF_TOKEN='xxxxxxxxxxxxxxxxxx' .github/packaging/common/test/README-test.sh
410
# This assumes the current commit has already been built and is available on JFrog
@@ -14,11 +20,11 @@ PKG_VERSION=$(git describe --tags --always)
1420

1521
#Build the test container and install the current version of asconfig from JFrog
1622
# -d specifies the distro to test
17-
TEST_MODE=true .github/packaging/common/test/entrypoint.sh -c -d el9
23+
TEST_MODE=true .github/packaging/common/test/entrypoint.sh -c -d "$DISTRO"
1824
#...
1925

2026
#Execute the test runner
21-
docker run -t -i "asconfig-pkg-tester-el9:$(git describe --tags --always)"
27+
docker run "$REPO_NAME-pkg-tester-$DISTRO:$(git describe --tags --always)"
2228

2329
#...
2430
#test_execute.bats

header.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env bash
22

33
function install_deps () {
4-
"install_deps_$1"
4+
if type "install_deps_$1" > /dev/null 2>&1; then
5+
"install_deps_$1"
6+
fi
7+
if type "compile_deps_$1" > /dev/null 2>&1; then
8+
"compile_deps_$1"
9+
fi
510
}
611

project-example/gha-main.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -xeuo pipefail
3+
DISTRO="$1"
4+
env
5+
cd local
6+
git fetch --unshallow --tags --no-recurse-submodules
7+
git submodule update --init
8+
ls -laht
9+
git branch -v
10+
.github/packaging/common/entrypoint.sh -c -d "$DISTRO"
11+
.github/packaging/common/entrypoint.sh -e -d "$DISTRO"
12+
ls -laht ../dist

0 commit comments

Comments
 (0)