Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jc21 committed Feb 14, 2019
0 parents commit 4824654
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.idea
._*
.DS_Store
RPMS
SRPMS
DEPS
BUILD
BUILDROOT

114 changes: 114 additions & 0 deletions Jenkinsfile.centos6
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/usr/bin/env groovy
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
}
agent {
label 'rpm'
}
stages {
stage('Prepare') {
steps {
sh 'docker pull ${DOCKER_RPMBUILD_EL6}'
sh 'docker pull ${DOCKER_CI_TOOLS}'
}
}
stage('Build') {
steps {
sh '''CWD=`pwd`
PACKAGE=prettyping
BUILD_SPEC_ARGS=
mkdir -p RPMS && chmod -R 777 RPMS
mkdir -p SRPMS && chmod -R 777 SRPMS
CMD="docker run --rm \\
--name rpmbuild-$BUILD_TAG \\
-v $CWD/RPMS:/home/rpmbuilder/rpmbuild/RPMS \\
-v $CWD/SRPMS:/home/rpmbuilder/rpmbuild/SRPMS \\
-v $CWD/SPECS:/home/rpmbuilder/rpmbuild/SPECS \\
-v $CWD/SOURCES:/home/rpmbuilder/rpmbuild/SOURCES \\
${DOCKER_RPMBUILD_EL6} \\
/bin/build-spec $BUILD_SPEC_ARGS -- /home/rpmbuilder/rpmbuild/SPECS/$PACKAGE.spec"
$CMD
exit $?'''
}
}
stage('Sign') {
steps {
sh '''rm -rf sign
mkdir -p sign
exit 0'''
dir(path: 'sign') {
git(url: "${RPM_SIGN_GIT_REPO}", credentialsId: "${RPM_SIGN_CREDENTIALS_ID}")
sh 'chmod 600 .gnupg/*'
}

sh '''CWD=`pwd`
for RPMFILE in RPMS/*/*.rpm
do
CMD="docker run --rm \\
--name rpmbuild-$BUILD_TAG \\
-v $CWD/RPMS:/data/RPMS \\
-v $CWD/sign:/data/sign \\
-v $CWD/sign/.rpmmacros:/root/.rpmmacros \\
-v $CWD/sign/.gnupg:/root/.gnupg \\
${DOCKER_CI_TOOLS} \\
/data/sign/addsign.exp /data/$RPMFILE"
$CMD
# exit if bad return code
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
done
# source rpms
for RPMFILE in SRPMS/*.src.rpm
do
CMD="docker run --rm \\
--name rpmbuild-$BUILD_TAG \\
-v $CWD/SRPMS:/data/SRPMS \\
-v $CWD/sign:/data/sign \\
-v $CWD/sign/.rpmmacros:/root/.rpmmacros \\
-v $CWD/sign/.gnupg:/root/.gnupg \\
${DOCKER_CI_TOOLS} \\
/data/sign/addsign.exp /data/$RPMFILE"
$CMD
# exit if bad return code
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
done
'''
}
}
stage('Publish') {
steps {
dir(path: 'RPMS') {
archiveArtifacts(artifacts: '**/*/*.rpm', caseSensitive: true, onlyIfSuccessful: true)
}

dir(path: 'SRPMS') {
archiveArtifacts(artifacts: '**/*.src.rpm', caseSensitive: true, onlyIfSuccessful: true, allowEmptyArchive: true)
}
}
}
}
triggers {
bitbucketPush()
}
post {
success {
juxtapose event: 'success'
sh 'figlet "SUCCESS"'
}
failure {
juxtapose event: 'failure'
sh 'figlet "FAILURE"'
}
}
}
114 changes: 114 additions & 0 deletions Jenkinsfile.centos7
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/usr/bin/env groovy
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
}
agent {
label 'rpm'
}
stages {
stage('Prepare') {
steps {
sh 'docker pull ${DOCKER_RPMBUILD_EL7}'
sh 'docker pull ${DOCKER_CI_TOOLS}'
}
}
stage('Build') {
steps {
sh '''CWD=`pwd`
PACKAGE=prettyping
BUILD_SPEC_ARGS=
mkdir -p RPMS && chmod -R 777 RPMS
mkdir -p SRPMS && chmod -R 777 SRPMS
CMD="docker run --rm \\
--name rpmbuild-$BUILD_TAG \\
-v $CWD/RPMS:/home/rpmbuilder/rpmbuild/RPMS \\
-v $CWD/SRPMS:/home/rpmbuilder/rpmbuild/SRPMS \\
-v $CWD/SPECS:/home/rpmbuilder/rpmbuild/SPECS \\
-v $CWD/SOURCES:/home/rpmbuilder/rpmbuild/SOURCES \\
${DOCKER_RPMBUILD_EL7} \\
/bin/build-spec $BUILD_SPEC_ARGS -- /home/rpmbuilder/rpmbuild/SPECS/$PACKAGE.spec"
$CMD
exit $?'''
}
}
stage('Sign') {
steps {
sh '''rm -rf sign
mkdir -p sign
exit 0'''
dir(path: 'sign') {
git(url: "${RPM_SIGN_GIT_REPO}", credentialsId: "${RPM_SIGN_CREDENTIALS_ID}")
sh 'chmod 600 .gnupg/*'
}

sh '''CWD=`pwd`
for RPMFILE in RPMS/*/*.rpm
do
CMD="docker run --rm \\
--name rpmbuild-$BUILD_TAG \\
-v $CWD/RPMS:/data/RPMS \\
-v $CWD/sign:/data/sign \\
-v $CWD/sign/.rpmmacros:/root/.rpmmacros \\
-v $CWD/sign/.gnupg:/root/.gnupg \\
${DOCKER_CI_TOOLS} \\
/data/sign/addsign.exp /data/$RPMFILE"
$CMD
# exit if bad return code
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
done
# source rpms
for RPMFILE in SRPMS/*.src.rpm
do
CMD="docker run --rm \\
--name rpmbuild-$BUILD_TAG \\
-v $CWD/SRPMS:/data/SRPMS \\
-v $CWD/sign:/data/sign \\
-v $CWD/sign/.rpmmacros:/root/.rpmmacros \\
-v $CWD/sign/.gnupg:/root/.gnupg \\
${DOCKER_CI_TOOLS} \\
/data/sign/addsign.exp /data/$RPMFILE"
$CMD
# exit if bad return code
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
done
'''
}
}
stage('Publish') {
steps {
dir(path: 'RPMS') {
archiveArtifacts(artifacts: '**/*/*.rpm', caseSensitive: true, onlyIfSuccessful: true)
}

dir(path: 'SRPMS') {
archiveArtifacts(artifacts: '**/*.src.rpm', caseSensitive: true, onlyIfSuccessful: true, allowEmptyArchive: true)
}
}
}
}
triggers {
bitbucketPush()
}
post {
success {
juxtapose event: 'success'
sh 'figlet "SUCCESS"'
}
failure {
juxtapose event: 'failure'
sh 'figlet "FAILURE"'
}
}
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# [prettyping](https://github.com/denilsonsa/prettyping)

Builds for Centos 6/7 hosted on [yum.jc21.com](https://yum.jc21.com)

40 changes: 40 additions & 0 deletions SPECS/prettyping.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
%global debug_package %{nil}

Name: prettyping
Version: 1.0.1
Release: 1%{?dist}
Summary: prettyping is a wrapper around the standard ping tool, making the output prettier, more colorful, more compact, and easier to read.
License: MIT
URL: https://github.com/denilsonsa/%{name}
BuildArch: noarch
Requires: bash >= 3.0

%description
prettyping is a wrapper around the standard ping tool with the objective of making
the output prettier, more colorful, more compact, and easier to read. prettyping
runs the standard ping in the background and parses its output, showing the ping
responses in a graphical way at the terminal (by using colors and Unicode characters).
prettyping is written in bash and awk, and is reported to work on many different
systems (Linux, Mac OS X, BSD…), as well as running on different versions of awk
(gawk, mawk, nawk, busybox awk).

%prep
wget https://github.com/denilsonsa/%{name}/archive/v%{version}.tar.gz
tar xzf v%{version}.tar.gz

%build
cd %{name}-%{version}
sed 's,/usr/bin/env bash,/bin/bash,g' -i prettyping

%install
mkdir -p %{buildroot}/usr/bin
install -m755 %{name}-%{version}/%{name} %{buildroot}/usr/bin

%files
%{_bindir}/%{name}
%doc %{name}-%{version}/README.md

%changelog
* Fri Aug 31 2018 Jamie Curnow <[email protected]> - 1.0.1-1
- Initial spec

0 comments on commit 4824654

Please sign in to comment.