Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROD-2028 add ci pipeline and packaging #58

Draft
wants to merge 97 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
9ad31ad
packaging steps
pvinh-spike Sep 28, 2021
cf42780
Update build.yml
pvinh-spike Sep 28, 2021
c42c2b6
Update Makefile.deb
pvinh-spike Sep 28, 2021
c09b11b
Update build.yml
pvinh-spike Sep 28, 2021
62ee9bd
Update build.yml
pvinh-spike Sep 28, 2021
4f0a588
Update build.yml
pvinh-spike Sep 28, 2021
d1d7c5c
Update build.yml
pvinh-spike Sep 28, 2021
836bb98
Update build.yml
pvinh-spike Sep 28, 2021
8fe1b8b
Update Makefile.deb
pvinh-spike Sep 28, 2021
7fc14f2
Update build.yml
pvinh-spike Sep 28, 2021
9e9401b
Update Makefile.deb
pvinh-spike Sep 28, 2021
967942d
Update Makefile.deb
pvinh-spike Sep 28, 2021
907074f
Update build.yml
pvinh-spike Sep 29, 2021
437d412
Update build.yml
pvinh-spike Sep 29, 2021
188d2ac
Update build.yml
pvinh-spike Sep 29, 2021
e2f0393
Update build.yml
pvinh-spike Sep 29, 2021
d23ab83
Update build.yml
pvinh-spike Sep 29, 2021
20342f4
Update build.yml
pvinh-spike Sep 29, 2021
ff95916
Update build.yml
pvinh-spike Sep 29, 2021
a36faf4
Update build.yml
pvinh-spike Sep 29, 2021
b257838
Update build.yml
pvinh-spike Sep 29, 2021
ca23a71
Update build.yml
pvinh-spike Sep 29, 2021
7603e82
Update build.yml
pvinh-spike Sep 29, 2021
9840c24
Update build.yml
pvinh-spike Sep 29, 2021
738cf89
Update build.yml
pvinh-spike Sep 29, 2021
7e0561a
Update build.yml
pvinh-spike Sep 29, 2021
3cc8fbd
Update build.yml
pvinh-spike Sep 29, 2021
84f2940
Update build.yml
pvinh-spike Sep 29, 2021
e462765
Update build.yml
pvinh-spike Sep 29, 2021
e89512b
Update build.yml
pvinh-spike Sep 29, 2021
c7ec80f
Update build.yml
pvinh-spike Sep 29, 2021
97e3a27
Update build.yml
pvinh-spike Sep 29, 2021
cc51ccb
Update build.yml
pvinh-spike Sep 29, 2021
b116558
Update act_latency.py
pvinh-spike Sep 29, 2021
c26d941
Update postinst
pvinh-spike Sep 29, 2021
0f50bc3
Update Makefile.deb
pvinh-spike Sep 29, 2021
e88bc62
Corrected ouput message
pvinh-spike Sep 29, 2021
73d7633
Remove extra files
pvinh-spike Sep 29, 2021
4ed1f4e
change package name
pvinh-spike Sep 29, 2021
14bd891
Update build.yml
pvinh-spike Sep 29, 2021
630e9b1
update workflow
pvinh-spike Sep 29, 2021
0d7316c
Update build.yml
pvinh-spike Sep 29, 2021
931ef9d
Update build.yml
pvinh-spike Sep 29, 2021
c49f37d
Update build.yml
pvinh-spike Sep 29, 2021
0e45c3b
Delete act-6.2-37.ubuntu20.04.x86_64.deb
pvinh-spike Sep 29, 2021
6b8004f
add debug message
pvinh-spike Sep 29, 2021
fca5087
add packages dir
pvinh-spike Sep 29, 2021
637c8eb
Update build.yml
pvinh-spike Sep 29, 2021
ce0a59e
Update build.yml
pvinh-spike Sep 30, 2021
67c4468
Update build.yml
pvinh-spike Sep 30, 2021
6824c6e
Update build.yml
pvinh-spike Sep 30, 2021
8822808
Update build.yml
pvinh-spike Sep 30, 2021
116c257
Update build.yml
pvinh-spike Sep 30, 2021
4de8f94
Update build.yml
pvinh-spike Sep 30, 2021
7099e72
Update build.yml
pvinh-spike Sep 30, 2021
25c4d58
Update build.yml
pvinh-spike Sep 30, 2021
073a0ef
Update build.yml
pvinh-spike Sep 30, 2021
b53f78e
Update build.yml
pvinh-spike Sep 30, 2021
c71574b
Update build.yml
pvinh-spike Sep 30, 2021
ab559da
Update build.yml
pvinh-spike Sep 30, 2021
efe4732
Update build.yml
pvinh-spike Sep 30, 2021
ffd8537
Update build.yml
pvinh-spike Sep 30, 2021
f5640a7
Update build.yml
pvinh-spike Sep 30, 2021
20b4f71
Update build.yml
pvinh-spike Sep 30, 2021
66e2a2f
Update build.yml
pvinh-spike Sep 30, 2021
025feed
Update build.yml
pvinh-spike Sep 30, 2021
7027284
Update build.yml
pvinh-spike Sep 30, 2021
652bf59
Update build.yml
pvinh-spike Sep 30, 2021
28a81ce
Update build.yml
pvinh-spike Sep 30, 2021
a122383
Update build.yml
pvinh-spike Sep 30, 2021
e75da8c
Update build.yml
pvinh-spike Sep 30, 2021
142f71c
Test export env
pvinh-spike Sep 30, 2021
3d1180f
export env
pvinh-spike Sep 30, 2021
36235d6
Update build.yml
pvinh-spike Sep 30, 2021
c8dc36c
Update build.yml
pvinh-spike Sep 30, 2021
6413a4c
Update build.yml
pvinh-spike Sep 30, 2021
feed66b
Update build.yml
pvinh-spike Sep 30, 2021
eb29b71
Update build.yml
pvinh-spike Sep 30, 2021
e553e73
Update build.yml
pvinh-spike Sep 30, 2021
a19ee63
Update build.yml
pvinh-spike Sep 30, 2021
e02f0ab
Update build.yml
pvinh-spike Sep 30, 2021
b04872b
Update build.yml
pvinh-spike Sep 30, 2021
67ae41b
Update build.yml
pvinh-spike Sep 30, 2021
622a2e9
add rpm package
pvinh-spike Oct 1, 2021
6bb81cf
rpm packaging
pvinh-spike Oct 1, 2021
63a3d7b
Update build.yml
pvinh-spike Oct 1, 2021
6af2cea
Update build.yml
pvinh-spike Oct 1, 2021
02cb65a
Update build.yml
pvinh-spike Oct 1, 2021
b797542
Update Makefile.rpm
pvinh-spike Oct 1, 2021
b6ebda9
Update build.yml
pvinh-spike Oct 12, 2021
8082885
Update Makefile
pvinh-spike Oct 12, 2021
bfdf4ac
update makefile & yml file
pvinh-spike Oct 12, 2021
47a30b9
Update makefiles
pvinh-spike Oct 12, 2021
559a7e1
Update build.yml
pvinh-spike Oct 12, 2021
78435c1
Update build.yml
pvinh-spike Oct 12, 2021
ebd6aa9
Update build.yml
pvinh-spike Oct 13, 2021
57679a7
Update act_latency.py
pvinh-spike Oct 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 72 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,77 @@ name: Build ACT

on:
push:
branches: [ master ]
pull_request:
branches: [ naster ]

branches: [ PROD-2028 ]

jobs:
build:

buils_atl:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: configure
run: sudo apt-get install make gcc libc6-dev
- name: build
run: make
- name: Upload Artifact
uses: actions/[email protected]
with:
name: act
path: target/bin/
if-no-files-found: error
strategy:
matrix:
container: [ 'centos:7', 'centos:8', 'debian:9', 'debian:10', 'debian:11' ]
container:
image: ${{ matrix.container }}
options: "--entrypoint /bin/bash"
steps:
- name: Install Dependencies (centos 7 & 8)
run: |
yum install -y make gcc git rpm-build
if: matrix.container == 'centos:7' || matrix.container == 'centos:8'
- name: Install Dependencies (Debian)
run: |
apt-get -y update
apt-get -y install make gcc libc6-dev git build-essential
if: |
matrix.container == 'debian:9' || matrix.container == 'debian:10' || matrix.container == 'debian:11'
- name: Clone Source
run: git clone --branch PROD-2028 https://github.com/aerospike/act.git
- name: buils act (centos)
working-directory: ./act
if: matrix.container == 'centos:7' || matrix.container == 'centos:8'
run: |
echo "REV=$(make -f pkg/Makefile.deb print-REV)" >> $GITHUB_ENV
echo "OS=$(make -f pkg/Makefile.deb print-OS)" >> $GITHUB_ENV
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
make all rpm
- name: build act (debian)
working-directory: ./act
if: |
matrix.container == 'debian:9' || matrix.container == 'debian:10' || matrix.container == 'debian:11'
run: |
echo "REV=$(make -f pkg/Makefile.deb print-REV)" >> $GITHUB_ENV
echo "OS=$(make -f pkg/Makefile.deb print-OS)" >> $GITHUB_ENV
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
make all deb
- name: Upload Artifacts
uses: actions/[email protected]
with:
name: act-${{ env.REV }}-${{ env.OS }}-${{ env.GITHUB_SHA_SHORT }}
path: /__w/act/act/act/target/packages/act-*
if-no-files-found: error

build:
strategy:
matrix:
os: [ 'ubuntu-20.04', 'ubuntu-18.04' ]
runs-on: ${{ matrix.os }}
steps:
- name: Install Dependencies
run: sudo apt-get install make gcc libc6-dev
- name: Get Sources
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set env
run: |
echo "REV=$(make -f pkg/Makefile.deb print-REV)" >> $GITHUB_ENV
echo "OS=$(make -f pkg/Makefile.deb print-OS)" >> $GITHUB_ENV
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
ls -la
- name: build
run: make all deb
- name: Upload Artifact
uses: actions/[email protected]
with:
name: act-${{ env.REV }}-${{ env.OS }}-${{ env.GITHUB_SHA_SHORT }}
path: target/packages
if-no-files-found: error
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bin
obj
target
dist
act_v.spec
pkg/packages
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
DIR_TARGET = target
DIR_OBJ = $(DIR_TARGET)/obj
DIR_BIN = $(DIR_TARGET)/bin
DIR_PKG = $(DIR_TARGET)/packages
DIR_RPM = pkg/rpm/RPMS
DIR_DEB = pkg/deb/DEBS

SRC_DIRS = common index prep storage
OBJ_DIRS = $(SRC_DIRS:%=$(DIR_OBJ)/src/%)
Expand Down Expand Up @@ -52,9 +55,21 @@ act_storage: target_dir $(STORAGE_OBJECTS)
echo "Linking $@"
$(CC) $(LDFLAGS) -o $(STORAGE_BINARY) $(STORAGE_OBJECTS) $(LIBRARIES)

.PHONY: rpm
rpm:
$(MAKE) -f pkg/Makefile.rpm

.PHONY: deb
deb:
$(MAKE) -f pkg/Makefile.deb

# For now we only clean everything.
.PHONY: clean
clean:
/bin/rm -rf $(DIR_TARGET)
/bin/rm -rf $(DIR_RPM)
/bin/rm -rf $(DIR_DEB)
/bin/rm -rf dist

-include $(ALL_DEPENDENCIES)

Expand Down
139 changes: 139 additions & 0 deletions build/os_version
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#!/usr/bin/env bash
# ------------------------------------------------------------------------------
# Copyright 2012-2015 Aerospike, Inc.
#
# Portions may be licensed to Aerospike, Inc. under one or more contributor
# license agreements.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# ------------------------------------------------------------------------------

OPT_LONG=0

if [ "$1" = "-long" ]
then
OPT_LONG=1
fi

error() {
echo 'error:' $* >&2
}

main() {

local kernel=''
local distro_id=''
local distro_version=''
local distro_long=''
local distro_short=''

# Make sure this script is running on Linux
# The script is not designed to work on non-Linux
# operating systems.
kernel=$(uname -s | tr '[:upper:]' '[:lower:]')
if [ "$kernel" != 'linux' ]
then
error "$kernel is not supported."
exit 1
fi

if [ -f /etc/os-release ]
then
. /etc/os-release
distro_id=${ID,,}
distro_version=${VERSION_ID}
elif [ -f /etc/issue ]
then
issue=$(cat /etc/issue | tr '[:upper:]' '[:lower:]')
case "$issue" in
*'centos'* )
distro_id='centos'
;;
*'redhat'* | *'rhel'* )
distro_id='rhel'
;;
*'debian'* )
distro_id='debian'
;;
* )
error "/etc/issue contained an unsupported linux distibution: $issue"
exit 1
;;
esac

case "$distro_id" in
'centos' | 'rhel' )
local release=''
if [ -f /etc/centos-release ]; then
release=$(cat /etc/centos-release | tr '[:upper:]' '[:lower:]')
elif [ -f /etc/redhat-release ]; then
release=$(cat /etc/redhat-release | tr '[:upper:]' '[:lower:]')
fi
release_version=${release##*release}
distro_version=${release_version%.*}
;;
'debian' )
debian_version=$(cat /etc/debian_version | tr '[:upper:]' '[:lower:]')
distro_version=${debian_version%%.*}
;;
* )
error "/etc/issue contained an unsupported linux distibution: $issue"
exit 1
;;
esac
fi

distro_id=${distro_id//[[:space:]]/}
distro_version=${distro_version//[[:space:]]/}

case "$distro_id" in
'centos' )
distro_long="${distro_id}${distro_version%%.*}"
distro_short="el${distro_version%%.*}"
;;
'rhel' | 'redhat' | 'red hat' )
distro_long="${distro_id}${distro_version%%.*}"
distro_short="el${distro_version%%.*}"
;;
'fedora' )
if [ "$distro_version" -gt "15" ]
then
distro_version=7
elif [ "$distro_version" -gt "10" ]
then
distro_version=6
else
error "Unsupported linux distibution: $distro_id $distro_version"
exit 1
fi
distro_long="centos${distro_version}"
distro_short="el${distro_version}"
;;
'amzn' )
distro_long="ami"
distro_short="ami"
;;
* )
distro_long="${distro_id}${distro_version}"
distro_short="${distro_id}${distro_version}"
;;
esac

if [ "$OPT_LONG" = "1" ]
then
echo "${distro_long}"
else
echo "${distro_short}"
fi
exit 0
}

main
10 changes: 10 additions & 0 deletions build/version
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

rev=`git describe`
subbuild=`echo $rev | awk -F'-' '{print $2}'`
if [ "$subbuild" != "" ]
then
# rev=`echo $rev | awk -F'-' '{printf("%s-%s\n",$1,$2)}'`
rev=`echo $rev | awk -F'-' '{printf("%s\n",$1)}'`
fi
echo $rev
60 changes: 60 additions & 0 deletions pkg/Makefile.deb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Build act distribution.

export DEB_SOURCE_ROOT = $(shell echo `pwd`/dist)
export DEB_BUILD_ROOT = $(DEB_SOURCE_ROOT)/BUILD
export CL_BASE = $(DEB_BUILD_ROOT)/opt/aerospike
export ETC_BASE = $(DEB_BUILD_ROOT)/etc/aerospike


#REV = $(shell git describe 2>/dev/null; if [ $${?} != 0 ]; then echo 'unknown'; fi)
DIR_PKG = target/packages
REV = $(shell build/version)
OS = $(shell build/os_version)

MANIFEST_DIR = manifest/TEMP

.PHONY: default
default: dist

.PHONY: dist
dist:

# Build act package.
@echo $(REV)
@echo $(OS)
rm -rf $(DEB_BUILD_ROOT)/*
mkdir -p $(DEB_BUILD_ROOT)/DEBIAN
mkdir -p $(DEB_BUILD_ROOT)/usr/bin
mkdir -p $(DIR_PKG)
install -m 755 pkg/deb/postinst $(DEB_BUILD_ROOT)/DEBIAN/postinst
install -m 755 pkg/deb/prerm $(DEB_BUILD_ROOT)/DEBIAN/prerm
install -m 644 pkg/deb/control $(DEB_BUILD_ROOT)/DEBIAN/control

mkdir -p $(CL_BASE)
mkdir -p $(ETC_BASE)
mkdir -p $(CL_BASE)/bin

# act
install -m 755 target/bin/act_* $(CL_BASE)/bin/
install -m 755 analysis/act_latency.py $(CL_BASE)/bin/
install -m 755 config/act_index.conf $(ETC_BASE)/
install -m 755 config/act_storage.conf $(ETC_BASE)/

# Create symlinks to /usr/bin
mkdir -p $(DEB_BUILD_ROOT)/usr/bin
ln -sf /opt/aerospike/bin/act_index $(DEB_BUILD_ROOT)/usr/bin/act_index
ln -sf /opt/aerospike/bin/act_prep $(DEB_BUILD_ROOT)/usr/bin/act_prep
ln -sf /opt/aerospike/bin/act_storage $(DEB_BUILD_ROOT)/usr/bin/act_storage
ln -sf /opt/aerospike/bin/act_latency.py $(DEB_BUILD_ROOT)/usr/bin/act_latency.py


sed 's/@VERSION@/'$(REV)'/g' <pkg/deb/control >$(DEB_BUILD_ROOT)/DEBIAN/control

fakeroot dpkg-deb --build $(DEB_BUILD_ROOT) $(DIR_PKG)/act-$(REV).$(OS).x86_64.deb
rm -rf dist

distclean:
rm -rf $(DEB_SOURCE_ROOT)
rm -rf target/packages

print-% : ; @echo $($*)
45 changes: 45 additions & 0 deletions pkg/Makefile.rpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Build ACT rpm distribution.

export RPM_SOURCE_ROOT = $(shell echo `pwd`/dist)
export RPM_BUILD_ROOT = $(RPM_SOURCE_ROOT)/BUILD
export CL_BASE = $(RPM_BUILD_ROOT)/opt/aerospike
export ETC_BASE = $(RPM_BUILD_ROOT)/etc/aerospike

MANIFEST_DIR = manifest/TEMP
DIR_PKG = target/packages
#REV = $(shell git describe 2>/dev/null; if [ $${?} != 0 ]; then echo 'unknown'; fi)
REV = $(shell build/version)
OS = $(shell build/os_version)

.PHONY: default
default: dist
mkdir -p $(DIR_PKG)
mkdir -p $(RPM_BUILD_ROOT)
mkdir -p $(RPM_SOURCE_ROOT)/RPMS/x86_64
mkdir -p $(RPM_BUILD_ROOT)/usr/bin

sed 's/@VERSION@/'$(REV)'/g' <pkg/rpm/act.spec >pkg/act_v.spec
sed -i 's/@RELEASE@/'$(OS)'/g' pkg/act_v.spec

rpmbuild -bb -vv --define "dist .$(OS)" --buildroot $(RPM_BUILD_ROOT) pkg/act_v.spec
find $(RPM_SOURCE_ROOT)/RPMS -type f -exec mv {} $(DIR_PKG) \;
rm -rf pkg/act_v.spec dist

distclean:
rm -rf $(RPM_BUILD_ROOT)
rm -rf target/packages:

.PHONY: dist
dist:

mkdir -p $(CL_BASE)
mkdir -p $(ETC_BASE)
mkdir -p $(CL_BASE)/bin

# act
install -m 755 target/bin/act_* $(CL_BASE)/bin/
install -m 755 analysis/act_latency.py $(CL_BASE)/bin/
install -m 755 config/act_index.conf $(ETC_BASE)/
install -m 755 config/act_storage.conf $(ETC_BASE)/

print-% : ; @echo $($*)
Loading