Skip to content

Commit

Permalink
Merge pull request #14 from ARGOeu-Metrics/devel
Browse files Browse the repository at this point in the history
Version 0.2.1
  • Loading branch information
themiszamani authored May 27, 2024
2 parents edc2013 + a9c1714 commit 3363b26
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
23 changes: 18 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,38 @@ pipeline {
stages {
stage ('Build'){
parallel {
stage ('Build Centos 7') {
stage ('CentOS 7') {
agent {
docker {
image 'argo.registry:5000/epel-7-ams'
alwaysPull true
args '-u jenkins:jenkins'
}
}
steps {
echo 'Building Rpm...'
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
}
post {
always {
cleanWs()
}
stage ('Rocky 9') {
agent {
docker {
image 'argo.registry:5000/epel-9-ams'
alwaysPull true
args '-u jenkins:jenkins'
}
}
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 Down
12 changes: 11 additions & 1 deletion argo-probe-oidc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Name: argo-probe-oidc
Summary: ARGO probes for handling of OIDC tokens.
Version: 0.2.0
Version: 0.2.1
Release: 1%{?dist}
License: ASL 2.0
Group: Development/System
Expand All @@ -13,9 +13,17 @@ Prefix: %{_prefix}
BuildArch: noarch

BuildRequires: python3-devel

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

%else
Requires: python3-requests
Requires: python3-jwt

%endif

%description
This package includes probes for fetching OIDC access token and checking refresh token validity.

Expand All @@ -42,6 +50,8 @@ rm -rf $RPM_BUILD_ROOT


%changelog
* Wed May 22 2024 Katarina Zailac <kzailac@srce.hr> - 0.2.1-1%{?dist}
- ARGO-4547 Prepare el9 build for argo-probe-oidc
* Thu Oct 5 2023 Katarina Zailac <kzailac@srce.hr> - 0.2.0-1%{?dist}
- ARGO-4389 Set username as parameter to probe fetching OIDC token
* Thu Jun 30 2022 Katarina Zailac <kzailac@srce.hr> - 0.1.1-1%{?dist}
Expand Down
11 changes: 10 additions & 1 deletion modules/refresh_token_expiration.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ def __exit__(self, exc_type, exc_val, exc_tb):
def validate_token(args):
date_format = "%b %d %Y %H:%M:%S"
try:
unix_time = jwt.decode(args.token, verify=False)["exp"]
jwt_options = {
"verify_signature": False,
"verify_exp": True,
"verify_nbf": False,
"verify_iat": False,
"verify_aud": False
}
unix_time = jwt.decode(
args.token, algorithms=["HS256"], options=jwt_options
)["exp"]
expiration_time = datetime.datetime.fromtimestamp(unix_time)
timedelta = expiration_time - datetime.datetime.today()

Expand Down

0 comments on commit 3363b26

Please sign in to comment.