-
Notifications
You must be signed in to change notification settings - Fork 277
310 lines (276 loc) · 12.2 KB
/
perl-cpan-libraries.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
name: perl-cpan-libraries
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- ".github/workflows/perl-cpan-libraries.yml"
push:
branches:
- develop
- dev-[2-9][0-9].[0-9][0-9].x
- master
- "[2-9][0-9].[0-9][0-9].x"
paths:
- ".github/workflows/perl-cpan-libraries.yml"
jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
package-rpm:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
runs-on: [self-hosted, common]
strategy:
fail-fast: false
matrix:
distrib: [el7]
name:
[
"Crypt::OpenSSL::AES",
]
include:
- build_distribs: "el7"
- rpm_dependencies: ""
- rpm_provides: ""
# - version: "0.21"
- version: "0.05"
- spec_file: ""
- distrib: el7
package_extension: rpm
image: packaging-plugins-centos7
name: package ${{ matrix.distrib }} ${{ matrix.name }}
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
credentials:
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE20: 'false'
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: 'true'
steps:
- run: git clone https://github.com/centreon/centreon-plugins.git --branch generate-perl-crypt-openssl-aes --single-branch
- run: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
# source ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 16
- uses: actions/[email protected]
with:
name: test
path: ./src
retention-days: 1
- if: ${{ contains(matrix.build_distribs, matrix.distrib) }}
run: |
# BASE CENTOS 7 REPOSITORIES
for file in $(grep -l mirrorlist /etc/yum.repos.d/CentOS-*);do
if [[ "$file" == "/etc/yum.repos.d/CentOS-CR.repo" ]];then
echo "Enabling vault.centos.org in $file"
sed -i 's/baseurl\=http\:\/\/mirror\.centos\.org/baseurl\=http\:\/\/vault\.centos\.org/g' $file
else
echo "Disabling mirrorlist.centos.org in $file"
sed -i 's/mirrorlist\=/\#mirrorlist\=/g' $file
echo "Enabling vault.centos.org in $file"
sed -i 's/\#baseurl\=http\:\/\/mirror\.centos\.org/baseurl\=http\:\/\/vault\.centos\.org/g' $file
fi
done
# SOFTWARE COLLECTION CENTOS 7 REPOSITORIES
for file in $(grep -l mirrorlist /etc/yum.repos.d/CentOS-SCLo*);do
echo "Disabling mirrorlist.centos.org in $file"
sed -i 's/mirrorlist\=/\#mirrorlist\=/g' $file
if [[ "$file" == "/etc/yum.repos.d/CentOS-SCLo-scl.repo" ]];then
echo "Enabling vault.centos.org in scl."
sed -i 's/\#\ baseurl\=http\:\/\/mirror\.centos\.org/baseurl\=http\:\/\/vault\.centos\.org/g' $file
elif [[ "$file" == "/etc/yum.repos.d/CentOS-SCLo-scl-rh.repo" ]];then
echo "Enabling vault.centos.org in scl-rh"
sed -i 's/\#baseurl\=http\:\/\/mirror\.centos\.org/baseurl\=http\:\/\/vault\.centos\.org/g' $file
else
echo "Not a SCL repo file"
fi
done
yum install -y yum-utils epel-release git
yum config-manager --set-enabled crb || true # alma 9
yum config-manager --set-enabled powertools || true # alma 8
yum install -y cpanminus rpm-build libcurl-devel libssh-devel expat-devel gcc libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny
# yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel
# curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
# echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
# echo 'eval "$(rbenv init -)"' >> ~/.bashrc
# source ~/.bashrc
# yum install -y ruby
# gem install fpm
# yum module reset -y ruby
# yum module enable -y ruby:3.1
# yum install -y ruby ruby-devel
# yum install -y centos-release-scl-rh
# # BASE CENTOS 7 REPOSITORIES
# for file in $(grep -l mirrorlist /etc/yum.repos.d/CentOS-*);do
# if [[ "$file" == "/etc/yum.repos.d/CentOS-CR.repo" ]];then
# echo "Enabling vault.centos.org in $file"
# sed -i 's/baseurl\=http\:\/\/mirror\.centos\.org/baseurl\=http\:\/\/vault\.centos\.org/g' $file
# else
# echo "Disabling mirrorlist.centos.org in $file"
# sed -i 's/mirrorlist\=/\#mirrorlist\=/g' $file
# echo "Enabling vault.centos.org in $file"
# sed -i 's/\#baseurl\=http\:\/\/mirror\.centos\.org/baseurl\=http\:\/\/vault\.centos\.org/g' $file
# fi
# done
# # SOFTWARE COLLECTION CENTOS 7 REPOSITORIES
# for file in $(grep -l mirrorlist /etc/yum.repos.d/CentOS-SCLo*);do
# echo "Disabling mirrorlist.centos.org in $file"
# sed -i 's/mirrorlist\=/\#mirrorlist\=/g' $file
# if [[ "$file" == "/etc/yum.repos.d/CentOS-SCLo-scl.repo" ]];then
# echo "Enabling vault.centos.org in scl."
# sed -i 's/\#\ baseurl\=http\:\/\/mirror\.centos\.org/baseurl\=http\:\/\/vault\.centos\.org/g' $file
# elif [[ "$file" == "/etc/yum.repos.d/CentOS-SCLo-scl-rh.repo" ]];then
# echo "Enabling vault.centos.org in scl-rh"
# sed -i 's/\#baseurl\=http\:\/\/mirror\.centos\.org/baseurl\=http\:\/\/vault\.centos\.org/g' $file
# else
# echo "Not a SCL repo file"
# fi
# done
# yum install -y devtoolset-7-gcc-c++
# yum install -y rbenv
# CC=/opt/rh/devtoolset-7/root/usr/bin/gcc rbenv install 3.1.4 -v
shell: bash
- run: |
yum install -y ruby
gem install dotenv -v 2.8.1 -N
gem install rexml -v 3.2.4 -N
gem install backports -v 3.21.0
gem install fpm -v 1.15.0
# gem install dotenv -v 2.8.1 -N
# gem install rexml -v 3.2.4 -N
# gem install backports -v 3.21.0 -N
# gem install fpm -N
# ~/.rbenv/bin/rbenv install 3.1.6 || true
# cat /tmp/ruby-build*
# gem install fpm
shell: bash
# - uses: ruby/setup-ruby@v1
# with:
# ruby-version: '3.1' # Not needed with a `.ruby-version` or `.tool-versions`
# bundler-cache: true
# - run: git clone https://github.com/kduret/fpm.git --branch fix-rpm-perl-dependency-name-unchanged --single-branch fpm
# - if: ${{ contains(matrix.build_distribs, matrix.distrib) }}
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# with:
# repository: kduret/fpm
# ref: fix-rpm-perl-dependency-name-unchanged
# path: fpm
# - if: ${{ contains(matrix.build_distribs, matrix.distrib) }}
# name: Build and install fpm # waiting https://github.com/jordansissel/fpm/pull/2066
# run: |
# yum install -y bsdtar
# cd fpm
# gem install bundler
# bundle install
# make install
# shell: bash
- if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }}
run: |
set -x
if [ -z "${{ matrix.version }}" ]; then
PACKAGE_VERSION=""
else
PACKAGE_VERSION=" -v ${{ matrix.version }}"
fi
if [ -z "${{ matrix.rpm_dependencies }}" ]; then
PACKAGE_DEPENDENCIES=""
else
for PACKAGE_DEPENDENCY in `echo "${{ matrix.rpm_dependencies }}"`; do
PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES --depends "$PACKAGE_DEPENDENCY""
done
fi
if [ -z "${{ matrix.rpm_provides }}" ]; then
PACKAGE_PROVIDES=""
else
for PACKAGE_PROVIDE in `echo "${{ matrix.rpm_provides }}"`; do
PACKAGE_PROVIDES="$PACKAGE_PROVIDES --provides $PACKAGE_PROVIDE"
done
fi
cpanm Module::Build::Tiny
cpanm Module::Install
cpanm MSCHWERN/ExtUtils-MakeMaker-6.64.tar.gz --notest
yum install -y perl-local-lib openssl-devel
PERL_CPANM_OPT="--notest --skip-installed --skip-satisfied" fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }}
shell: bash
- if: ${{ contains(matrix.build_distribs, matrix.distrib) }}
name: Replace '::' with - in the feature path
id: package-name
run: |
name="${{ matrix.name }}"
name_with_dash="${name//::/-}"
echo "Modified Name: $name_with_dash"
echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT
shell: bash
- if: ${{ contains(matrix.build_distribs, matrix.distrib) }}
uses: actions/upload-artifact@v3 # v4.4.0
with:
name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash }}
path: ./*.${{ matrix.package_extension }}
retention-days: 1
merge-package-rpm-artifacts:
needs: [get-environment, package-rpm]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
runs-on: ubuntu-24.04
strategy:
matrix:
distrib: [el7]
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: packages-rpm-${{ matrix.distrib }}
pattern: packages-rpm-${{ matrix.distrib }}-*
delete-merged: false # cannot be set to true due to random fails: Failed to DeleteArtifact: Unable to make request: ECONNRESET
retention-days: 1
- name: Delete merged artifacts
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0
with:
name: packages-rpm-${{ matrix.distrib }}-*
failOnError: false
sign-rpm:
needs: [get-environment, merge-package-rpm-artifacts]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
runs-on: ubuntu-24.04
strategy:
matrix:
distrib: [el7]
name: sign rpm ${{ matrix.distrib }}
container:
image: docker.centreon.com/centreon-private/rpm-signing:latest
options: -t
credentials:
username: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_USERNAME }}
password: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_TOKEN }}
steps:
- run: apt-get install -y zstd
shell: bash
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: packages-rpm-${{ matrix.distrib }}
path: ./
- run: echo "HOME=/root" >> $GITHUB_ENV
shell: bash
- run: rpmsign --addsign ./*.rpm
shell: bash
- uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ./*.rpm
key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: packages-signed-rpm-${{ matrix.distrib }}
path: ./*.rpm
retention-days: 1