Skip to content

Commit

Permalink
Merge pull request #174 from ARGOeu/devel
Browse files Browse the repository at this point in the history
Version 0.6.2
  • Loading branch information
themiszamani authored Jun 6, 2024
2 parents 477f3eb + ebeb484 commit 46ec9eb
Show file tree
Hide file tree
Showing 7 changed files with 242 additions and 92 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.6.2] - 2024-03-11

### Added

* ARGO-4425 Rocky 8 and 9 RPMs for argo-ams-library

## [0.6.1] - 2023-02-06

### Added
Expand Down
152 changes: 99 additions & 53 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,120 @@ pipeline {

}
stages {
stage ('Test'){
stage ('Testing and building...') {
parallel {
stage ('Test Centos 7') {
stage('Centos 7') {
agent {
docker {
image 'argo.registry:5000/epel-7-ams'
args '-u jenkins:jenkins'
}
}
steps {
echo 'Building Rpm...'
sh '''
cd ${WORKSPACE}/$PROJECT_DIR
rm -f .python-version &>/dev/null
source $HOME/pyenv.sh
PY310V=$(pyenv versions | grep ams-py310)
pyenv local 3.7.15 3.8.15 3.9.15 ${PY310V// /}
tox
coverage xml --omit=*usr* --omit=*.tox*
'''
cobertura coberturaReportFile: '**/coverage.xml'
stages {
stage ('Test Centos 7') {
steps {
echo 'Executing unit tests @ Centos 7...'
sh '''
cd ${WORKSPACE}/$PROJECT_DIR
rm -f .python-version &>/dev/null
rm -rf .coverage* .tox/ coverage.xml &> /dev/null
source $HOME/pyenv.sh
ALLPYVERS=$(pyenv versions | grep '^[ ]*[0-9]' | tr '\n' ' ')
PY310V=$(pyenv versions | grep ams-py310)
echo Found Python versions $ALLPYVERS $PY310V
pyenv local $ALLPYVERS ${PY310V// /}
export TOX_SKIP_ENV="py3[7,8,9,10,11].*"
tox -p all
coverage xml --omit=*usr* --omit=*.tox*
'''
cobertura coberturaReportFile: '**/coverage.xml'
}
}
stage ('Build Centos 7') {
steps {
echo 'Building Centos 7 RPM...'
withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \
keyFileVariable: 'REPOKEY')]) {
sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d centos7 -p ${PROJECT_DIR} -s ${REPOKEY}"
}
archiveArtifacts artifacts: '**/*.rpm', fingerprint: true
}
}
}
}
}
}
stage ('Build'){
parallel {
stage ('Build Centos 7') {
stage('Rocky 8') {
agent {
docker {
image 'argo.registry:5000/epel-7-ams'
image 'argo.registry:5000/epel-8-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 centos7 -p ${PROJECT_DIR} -s ${REPOKEY}"
stages {
stage ('Test Rocky 8') {
steps {
echo 'Executing unit tests @ Rocky 8...'
sh '''
cd ${WORKSPACE}/$PROJECT_DIR
rm -f .python-version &>/dev/null
rm -rf .coverage* .tox/ coverage.xml &> /dev/null
source $HOME/pyenv.sh
ALLPYVERS=$(pyenv versions | grep '^[ ]*[0-9]' | tr '\n' ' ')
echo Found Python versions $ALLPYVERS
pyenv local $ALLPYVERS
export TOX_SKIP_ENV="py27.*|py311.*"
tox -p 4
coverage xml --omit=*usr* --omit=*.tox*
'''
cobertura coberturaReportFile: '**/coverage.xml'
}
}
stage ('Build Rocky 8') {
steps {
echo 'Building Rocky 8 RPM...'
withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \
keyFileVariable: 'REPOKEY')]) {
sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d rocky8 -p ${PROJECT_DIR} -s ${REPOKEY}"
}
archiveArtifacts artifacts: '**/*.rpm', fingerprint: true
}
}
archiveArtifacts artifacts: '**/*.rpm', fingerprint: true
}
post {
always {
cleanWs()
}
stage('Rocky 9') {
agent {
docker {
image 'argo.registry:5000/epel-9-ams'
args '-u jenkins:jenkins'
}
}
stages {
stage ('Test Rocky 9') {
steps {
echo 'Executing unit tests @ Rocky 9...'
sh '''
cd ${WORKSPACE}/$PROJECT_DIR
rm -f .python-version &>/dev/null
rm -rf .coverage* .tox/ coverage.xml &> /dev/null
source $HOME/pyenv.sh
ALLPYVERS=$(pyenv versions | grep '^[ ]*[0-9]' | tr '\n' ' ')
echo Found Python versions $ALLPYVERS
pyenv local $ALLPYVERS
export TOX_SKIP_ENV="py27.*|py36.*"
tox -p all
coverage xml --omit=*usr* --omit=*.tox*
'''
cobertura coberturaReportFile: '**/coverage.xml'
}
}
stage ('Build Rocky 9') {
steps {
echo 'Building Rocky 9 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
}
}
}
}
Expand All @@ -81,35 +150,12 @@ pipeline {
'''
}
}
post {
always {
cleanWs()
}
}
}
}
post {
always {
echo 'Cleaning workspace and exiting'
cleanWs()
}
success {
script{
if ( env.BRANCH_NAME == 'devel' ) {
build job: '/ARGO/argodoc/devel', propagate: false
} else if ( env.BRANCH_NAME == 'master' ) {
build job: '/ARGO/argodoc/master', propagate: false
}
if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) {
slackSend( message: ":rocket: New version for <$BUILD_URL|$PROJECT_DIR>:$BRANCH_NAME Job: $JOB_NAME !")
}
}
}
failure {
script{
if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) {
slackSend( message: ":rain_cloud: Build Failed for <$BUILD_URL|$PROJECT_DIR>:$BRANCH_NAME Job: $JOB_NAME")
}
}
}
}
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rpm: dist

dist:
rm -rf dist
python setup.py sdist
python3 setup.py sdist
mv -f dist/${PKGNAME}-${PKGVERSION}.tar.gz .
rm -rf dist

Expand Down
52 changes: 27 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,32 @@

<img src="https://jenkins.argo.grnet.gr/static/3c75a153/images/headshot.png" alt="Jenkins" width="25"/> [![Build Status](https://jenkins.argo.grnet.gr/job/argo-ams-library_devel/badge/icon)](https://jenkins.argo.grnet.gr/job/argo-ams-library_devel)

A simple python library for interacting with the ARGO Messaging Service.
A simple python library for interacting with the ARGO Messaging Service.

The Messaging Services is implemented as a Publish/Subscribe Service. Instead of focusing on a single Messaging API specification for handling the logic of publishing/subscribing to the broker network the API focuses on creating nodes of Publishers and Subscribers as a Service.

In the Publish/Subscribe paradigm, Publishers are users/systems that can send messages to named-channels called Topics. Subscribers are users/systems that create Subscriptions to specific topics and receive messages.

You may find more information about [the ARGO Messaging Service documentation](http://argoeu.github.io/messaging/v1/)

## Library installation
## Library installation

Library is tested and should work with Python versions 2.6, 2.7, 3.4 and 3.6 running on CentOS 6 and CentOS 7 releases.
Library is tested and should work with Python versions 2.7, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11 running on CentOS 7, Rocky 8 and Rocky 9 releases.

RPM packages are prepared for both CentOS releases and you may find it and download it from ARGO Repository. PyPI packages are prepared as well.
RPM packages are prepared for CentOS and Rocky releases and you may find it and download it from ARGO Repository. PyPI packages are prepared as well.

RPM production packages:

http://rpm-repo.argo.grnet.gr/ARGO/prod/centos6/
http://rpm-repo.argo.grnet.gr/ARGO/prod/centos7/
* http://rpm-repo.argo.grnet.gr/ARGO/prod/centos7/
* http://rpm-repo.argo.grnet.gr/ARGO/prod/rocky8/
* http://rpm-repo.argo.grnet.gr/ARGO/prod/rocky9/

RPM devel packages:

http://rpm-repo.argo.grnet.gr/ARGO/devel/centos6/
http://rpm-repo.argo.grnet.gr/ARGO/devel/centos7/

* http://rpm-repo.argo.grnet.gr/ARGO/devel/centos7/
* http://rpm-repo.argo.grnet.gr/ARGO/devel/rocky8/
* http://rpm-repo.argo.grnet.gr/ARGO/devel/rocky9/

PyPI package:

https://pypi.org/project/argo-ams-library/
Expand Down Expand Up @@ -59,33 +61,33 @@ In the folder `examples`, you may find examples of using the library:
### Publish messages

This example explains how to publish messages in a topic with the use of the library. Topics are resources that can hold messages. Publishers (users/systems) can create topics on demand and name them (Usually with names that make sense and express the class of messages delivered in the topic). A topic name must be scoped to a project.

You may find more information about [Topics in the ARGO Messaging Service documentation](http://argoeu.github.io/messaging/v1/api_topics/)

```
publish.py --host=[the FQDN of AMS Service]
--token=[the user token]
--project=[the name of your project registered in AMS Service]
publish.py --host=[the FQDN of AMS Service]
--token=[the user token]
--project=[the name of your project registered in AMS Service]
--topic=[the topic to publish your messages]
```
### Consume messages in pull mode

### Consume messages in pull mode

This example explains how to consume messages from a predefined subscription with the use of the library. A subscription is a named resource representing the stream of messages from a single, specific topic, to be delivered to the subscribing application. A subscription name must be scoped to a project. In pull delivery, your subscriber application initiates requests to the Pub/Sub server to retrieve messages. When you create a subscription, the system establishes a sync point. That is, your subscriber is guaranteed to receive any message published after this point. Messages published before the sync point may not be delivered.

You may find more information about [Subscriptions in the ARGO Messaging Service documentation](http://argoeu.github.io/messaging/v1/api_subs/)

```
consume-pull.py --host=[the FQDN of AMS Service]
--token=[the user token]
--project=[the name of your project registered in AMS Service]
--topic=[the topic from where the messages are delivered ]
--subscription=[the subscription name to pull the messages]
consume-pull.py --host=[the FQDN of AMS Service]
--token=[the user token]
--project=[the name of your project registered in AMS Service]
--topic=[the topic from where the messages are delivered ]
--subscription=[the subscription name to pull the messages]
--nummsgs=[the num of messages to consume]
```

### Retry
### Retry

Library has self-implemented HTTP request retry ability to seamlesssly interact with the ARGO Messaging service. Specifically, requests will be retried in case of:
* timeouts from AMS (HTTP `408`) or load balancer (HTTP `408` and `504`)
Expand Down
Loading

0 comments on commit 46ec9eb

Please sign in to comment.