Skip to content

Commit

Permalink
Merge pull request #48 from ARGOeu/devel
Browse files Browse the repository at this point in the history
Version 0.2.7
  • Loading branch information
themiszamani authored Apr 4, 2024
2 parents 7a1abaf + 6bc9025 commit 3159c53
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 52 deletions.
44 changes: 42 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pipeline {
stages {
stage ('Build'){
parallel {
stage ('Build Centos 7') {
stage ('Build CentOS 7 RPM') {
agent {
docker {
image 'argo.registry:5000/epel-7-ams'
Expand All @@ -34,7 +34,28 @@ pipeline {
}
}
}
stage ('Execute tests') {
stage ('Build Rocky 9 RPM') {
agent {
docker {
image 'argo.registry:5000/epel-9-ams'
args '-u jenkins:jenkins'
}
}
steps {
echo 'Building Rpm...'
withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \
keyFileVariable: 'REPOKEY')]) {
sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d rocky9 -p ${PROJECT_DIR} -s ${REPOKEY}"
}
archiveArtifacts artifacts: '**/*.rpm', fingerprint: true
}
post {
always {
cleanWs()
}
}
}
stage ('Execute CentOS 7 tests') {
agent {
docker {
image 'argo.registry:5000/epel-7-ams'
Expand All @@ -53,6 +74,25 @@ pipeline {
junit '**/junit.xml'
}
}
stage ('Execute Rocky 9 tests') {
agent {
docker {
image 'argo.registry:5000/epel-9-ams'
args '-u jenkins:jenkins -v /dev/log:/dev/log'
}
}
steps {
sh '''
cd $WORKSPACE/$PROJECT_DIR/
rm -f tests/argo_poem_tools
ln -s $PWD/modules/ tests/argo_poem_tools
coverage run -m xmlrunner discover --output-file junit.xml -v tests/
coverage xml
'''
cobertura coberturaReportFile: '**/coverage.xml'
junit '**/junit.xml'
}
}
}
}
}
Expand Down
13 changes: 10 additions & 3 deletions argo-poem-tools.spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
%define underscore() %(echo %1 | sed 's/-/_/g')
%define stripc() %(echo %1 | sed 's/el7.centos/el7/')
%define mydist %{stripc %{dist}}

Summary: Script installs packages on ARGO mon boxes.
Name: argo-poem-tools
Version: 0.2.6
Version: 0.2.7
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
License: ASL 2.0
Expand All @@ -14,8 +12,15 @@ Prefix: %{_prefix}
BuildArch: noarch

BuildRequires: python3-devel

%if 0%{?el7}
Requires: python36-requests

%else
Requires: python3-requests

%endif


%description
Script which installs packages on ARGO mon boxes.
Expand Down Expand Up @@ -47,6 +52,8 @@ rm -rf $RPM_BUILD_ROOT
%attr(0755,root,root) %dir %{_localstatedir}/log/argo-poem-tools/

%changelog
* Thu Apr 4 2024 Katarina Zailac <[email protected]> - 0.2.7-1%{?dist}
- ARGO-4502 Generalize method for fetching distro name
* Thu Aug 3 2023 Katarina Zailac <[email protected]> - 0.2.6-1%{?dist}
- ARGO-4237 Add flag to install internal metrics
* Tue Jun 28 2022 Katarina Zailac <[email protected]> - 0.2.5-1%{?dist}
Expand Down
16 changes: 14 additions & 2 deletions modules/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,23 @@ def clean(self):

@classmethod
def _get_centos_version(cls):
string = subprocess.check_output(['rpm', '-q', 'centos-release'])
string = subprocess.check_output(["cat", "/etc/os-release"])

string = string.decode('utf-8')

return 'centos' + string.split('-')[2]
string_list = string.split("\n")

name = [
line.split("=")[1].lower().split(" ")[0].replace('"', "") for line
in string_list if line.startswith("NAME")
][0]

version = [
line.split("=")[1].split(".")[0].replace('"', "") for
line in string_list if line.startswith("VERSION_ID")
][0]

return f"{name}{version}"

def _build_url(self, include_internal=False):
hostname = self.hostname
Expand Down
Loading

0 comments on commit 3159c53

Please sign in to comment.