Skip to content

Instantly share code, notes, and snippets.

@O5ten
Created October 4, 2020 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save O5ten/fbfe6000cf5035d8298dd09a4601e7f5 to your computer and use it in GitHub Desktop.
Save O5ten/fbfe6000cf5035d8298dd09a4601e7f5 to your computer and use it in GitHub Desktop.
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