Jenkins (Scheduled Pipelines)
Pakyas requires an expected schedule. Use this integration for Jenkins jobs triggered by cron or timers (e.g., nightly builds, periodic tests).
1. Add Credential
Section titled “1. Add Credential”Go to Manage Jenkins > Credentials > System > Global credentials.
- Kind: Secret text
- Secret:
pk_live_... - ID:
PAKYAS_API_KEY
2. Pipeline Example (Declarative)
Section titled “2. Pipeline Example (Declarative)”pipeline { agent any triggers { cron('H 2 * * *') // nightly at ~2 AM } environment { PAKYAS_API_KEY = credentials('PAKYAS_API_KEY') } stages { stage('Prepare') { steps { // Installs to ~/.local/bin of the agent user sh 'curl -fsSL https://pakyas.com/install.sh | sh' } } stage('Build') { steps { sh '$HOME/.local/bin/pakyas monitor nightly-build -- ./gradlew build' } } }}The organization is taken from the API key, so no other Pakyas settings are needed. To avoid storing an API key, ping by public ID instead: pakyas monitor --public-id <PUBLIC_ID> -- ./gradlew build. See CI and Cron Setup.
Post-Build Actions
Section titled “Post-Build Actions”To send the pings from the post block instead (this assumes pakyas is on the agent’s PATH):
pipeline { agent any triggers { cron('H 2 * * *') // nightly at ~2 AM } environment { PAKYAS_API_KEY = credentials('PAKYAS_API_KEY') } stages { stage('Work') { steps { sh 'pakyas ping nightly-build --start' sh './do-work.sh' } } } post { success { sh 'pakyas ping nightly-build' } failure { sh 'pakyas ping nightly-build --fail' } }}