-
Notifications
You must be signed in to change notification settings - Fork 6
126 lines (110 loc) · 5.06 KB
/
custom-branch-builds.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Custom Branch Builds
on:
workflow_dispatch:
inputs:
buildosflavor:
description: 'Select the OS Flavour - centos / fedora / ubuntu / debian'
required: true
options: ['centos', 'fedora', 'ubuntu', 'debian']
default: 'fedora'
buildosver:
description: 'Select the OS version - centos (7/stream8) / fedora(Fxx/latest) / ubuntu(impish/jammy) / debian(bullseye)'
required: true
options: ['7', 'stream8', 'F33', 'focal', 'bullseye']
default: 'F33'
branchesflavor:
description: 'Select the Gluster Branch: eg:- devel, v10.1, v9.5,v8.6'
required: true
options: ['devel', 'v10.1', 'v9.5']
default: 'devel'
env:
OS: "${{ github.event.inputs.buildosflavor }}"
VER: "${{ github.event.inputs.buildosver }}"
BRANCH: "${{ github.event.inputs.branchesflavor }}"
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure Host
run: |
chmod +x Setup_Host.sh
./Setup_Host.sh
- name: Selecting build based on OS flavour
env:
OS_VER: '${{ env.OS }}:${{ env.VER }}'
run: echo $OS_VER
run: |
if [[ ${{ env.OS_VER }} == 'centos:7' ]]; then
#centos 7 : No need to select OS versions. ONLY Branch is required.
cp startscript-centos7.sh Docker/Centos7/
cd Docker/Centos7
docker build -t gluster-build .
docker run --name container_gluster -v /build-out:/out gluster-build $BRANCH
fi
if [[ ${{ env.OS_VER }} == 'centos:stream8' ]]; then
cp startscript.sh Docker/Centos8/
cd Docker/Centos8
docker build -t gluster-build .
docker run --name container_gluster -v /build-out:/out gluster-build $BRANCH
fi
if [[ ${{ env.OS }} == 'fedora' ]]; then
echo "Building for Fedora"
cp startscript.sh Docker/Fedora/
cd Docker/Fedora
VERSION=$(echo "${OS_VER//F}")
docker build -t gluster-build --build-arg MYAPP_IMAGE=$VERSION .
docker run --name container_gluster -v /build-out:/out gluster-build $BRANCH
fi
if [[ ${{ env.OS }} == 'ubuntu' ]]; then
echo "Building for Ubuntu"
cp build.sh Docker/Ubuntu/
cd Docker/Ubuntu
SUB='dev'
#when devel is passed, ubuntu requires the tag to build
if [[ "$BRANCH" == *"$SUB"* ]]; then
#devel means latest tag from the repo
DEVEL_BR=$(git ls-remote --tags --refs --sort="v:refname" https://github.com/gluster/glusterfs | tail -n1 | sed 's/.*\///')
BR=$(echo "${DEVEL_BR:1}")
#Devel is always the unreleased branch, we need a released branch no
TEMP=${BR%dev}
SER=$((TEMP-1))
MIN=1
else
BR=$(echo "${BRANCH:1}")
SER=${BR%.*}
MIN=${BRANCH#*.}
DEVEL_BR=$BRANCH
fi
docker build -t gluster-build --build-arg MYAPP_IMAGE=$OS_VER .
docker run --security-opt seccomp=unconfined --name container_gluster -v /build-out:/out gluster-build $OS $VER $SER $BR $MIN $DEVEL_BR
fi
if [[ ${{ env.OS }} == 'debian' ]]; then
echo "Building for Debian"
cp build.sh Docker/Debian/
cd Docker/Debian
SUB='dev'
#when devel is passed, debian requires the tag to build
if [[ "$BRANCH" == *"$SUB"* ]]; then
#devel means latest tag from the repo
DEVEL_BR=$(git ls-remote --tags --refs --sort="v:refname" https://github.com/gluster/glusterfs | tail -n1 | sed 's/.*\///')
BR=$(echo "${DEVEL_BR:1}")
#Devel is always the unreleased branch, we need a released branch no
TEMP=${BR%dev}
SER=$((TEMP-1))
MIN=1
else
BR=$(echo "${BRANCH:1}")
SER=${BR%.*}
MIN=${BRANCH#*.}
DEVEL_BR=$BRANCH
fi
docker build -t gluster-build --build-arg MYAPP_IMAGE=$OS_VER .
docker run --security-opt seccomp=unconfined --name container_gluster -v /build-out:/out gluster-build $OS $VER $SER $BR $MIN $DEVEL_BR
fi
- name: Upload Artifactory
uses: actions/upload-artifact@v2
with:
name: gluster-rpms
path: /build-out/*.*
retention-days: 1