Skip to content

Instantly share code, notes, and snippets.

@O5ten

O5ten/Jenkinsfile

Created Oct 4, 2020
Embed
What would you like to do?
def pass = [
"| Övning | Vikt |\\n| ---------- | :-------------: |\\n| Marklyft | 3 set x 6–8 reps |\\n| chins | 3 set x 8–10 reps |\\n| Militärpress | 3 set x 8–10 reps |",
"| Övning | Vikt |\\n| ---------- | :-------------: |\\n| Knäböj | 3 set x 8–10 reps |\\n| Bänkpress | 3 set x 8–10 reps |\\n| Chins | 3 set x 8–10 reps |"
]
def message = pass[(env.BUILD_ID as Integer) % pass.size()]
pipeline {
agent {
label 'linux'
}
triggers {
cron '0 15 * * 1,3'
}
environment {
GUSTAV='fxyfi7whstbmjp4sng7mppt9hr'
MICKE='7cnjxi1g6bdi8ffmo6tz3mc3co'
}
stages {
stage('Inform Lifter'){
steps {
withCredentials([string(credentialsId: 'MATTERMOST_WORKOUT_BOT', variable: 'BOT_BEARER_TOKEN')]) {
sh """curl -H "Authorization: Bearer $BOT_BEARER_TOKEN" https://mattermost.05ten.se/api/v4/posts -d '{"channel_id": "$GUSTAV", "message": "Idag är en träningsdag!\\n\\n**Dagens pass:**\\n\\n${message}"}'"""
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.