Jenkins integration
Configure Jenkins to call the quemsi CLI: store the token as a credential, install the binary on the agent, and fail the stage on non-zero exit.
Role: Pipeline owner · Time: about 10 minutes
There is no Jenkins plugin yet. Use a shell step (Declarative Pipeline or Freestyle). The CLI posts snapshot or restore and waits (--wait is the default). Exit 0 means SUCCESS; exit 1 means FAILED or SKIPPED — fail the build on that.
Recipes: Restore before tests and Snapshot before deploy. Install steps: Install and configure the quemsi CLI.
Before you start
- A Quemsi agent that Jenkins will call is ONLINE (usually a staging or CI agent, not a developer laptop).
- A company API token bound to that agent. Scopes:
restore+readfor test jobs,snapshot+readfor pre-deploy, or all three. See Create API tokens. - You know the data, agent, and (for restore) target datasource names.
- Jenkins can reach your Quemsi host (production is
https://quemsi.com) over HTTPS.
Steps
Store credentials in Jenkins
Manage Jenkins → Credentials → (domain) → Add credentials.
- Secret text for the token: ID
quemsi-token, secret =qsk_…. - Optional Secret text for the URL: ID
quemsi-url, secret =https://quemsi.com(or your host). If omitted, the CLI defaults tohttps://quemsi.com.
Do not put the token in the Jenkinsfile or in Git.
Install the CLI on the Jenkins agent
Prefer baking quemsi into the agent image or tool installation so every job does not download. One-shot install in a pipeline stage also works:
curl -fsSL -o quemsi https://quemsi.com/cli-releases/latest/quemsi
chmod +x quemsi
sudo mv quemsi /usr/local/bin/quemsi
quemsi --help
On Windows agents, download quemsi.exe onto PATH. Full options: Install and configure the quemsi CLI.
Restore before tests (Declarative Pipeline)
Restore overwrites the target database. Use a CI/test datasource, not production. The CLI prints you can watch progress at …/app/flows/execution/{id} on stderr while it waits.
pipeline {
agent any
environment {
QUEMSI_TOKEN = credentials('quemsi-token')
// Optional: QUEMSI_URL = credentials('quemsi-url')
}
stages {
stage('Restore known state') {
steps {
sh '''
quemsi restore \
--agent ci-staging \
--target-datasource app-db \
--data shopping-cart \
--tag use-case=e2e-baseline
'''
}
}
stage('Test') {
steps {
sh './gradlew test' // or mvn test, npm test, …
}
}
}
}
Replace names and tags with yours. Full restore contract: Restore before tests.
Snapshot before deploy (Declarative Pipeline)
Do not migrate or deploy until the snapshot stage exits 0.
pipeline {
agent any
environment {
QUEMSI_TOKEN = credentials('quemsi-token')
}
stages {
stage('Snapshot before deploy') {
steps {
sh '''
quemsi snapshot \
--data shopping-cart \
--agent ci-staging \
--tag release=${BUILD_NUMBER} \
--tag purpose=pre-deploy \
--descript "Jenkins build ${BUILD_TAG}"
'''
}
}
stage('Deploy') {
steps {
sh './deploy.sh'
}
}
}
}
Use a distinct tag combination so Restore can find this card later. Details: Snapshot before deploy.
Freestyle job (optional)
Add a Secret text binding for QUEMSI_TOKEN, then an Execute shell build step with the same quemsi restore or quemsi snapshot command. Mark the build failed if the step returns non-zero (Jenkins does this by default for shell steps).
Tips
- Timeouts: large databases may need
--timeout 60m(default is 30m). - Logs: open the printed console URL while signed into Quemsi to see flow steps and agent logs. The Jenkins console only shows CLI stderr/stdout.
- Parallel jobs: each job should restore its own target database (or agent) so suites do not share a mutable DB.
- Agent offline: if the Quemsi agent is down, the CLI fails — fix the agent, then re-run. Do not start tests after a failed restore.
- Same pattern works in GitLab CI, GitHub Actions, and Azure DevOps: secret + install CLI + one shell step.
Not this page
- CLI install only — Install and configure the quemsi CLI.
- Raw
/api/v1without the CLI — API reference. - Laptop coding agent — Coding agent snapshot.
Credentials, then a shell stage
Store QUEMSI_TOKEN in Jenkins, put quemsi on the agent PATH, and fail the build if snapshot or restore exits non-zero.