Jira CLI project creation and configuration import in a Dockerized Jira 8.20 environment
0 reputation · 03 May 2025, 14:42 UTC
0 reputation · 03 May 2025, 14:42 UTC
Establish a repeatable development environment for Jira Software 8.20 that uses Docker to launch a clean instance and the Jira CLI to automate project creation, workflow import, and rule replication.
The Docker image ‘atlassian/jira-software’ requires environment variables such as JIRA_DB_HOST and JIRA_DB_PASSWORD. The CLI plugin must match the core version to avoid syntax errors. Resetting the database with jira-admin db reset will delete all data, so it must be used only in isolated containers. Exported JSON files for projects, workflows, and automation rules must be compatible with the 8.20 API.
1. Does the jira-cli project create command support importing a workflow JSON file during project creation, or must the workflow be added afterward?
2. Are there any side effects when running jira-admin db reset inside a Docker container that could corrupt the home volume or lose configuration files?
3. What is the best practice to verify that the CLI plugin version aligns with Jira 8.20 before executing scripted setup commands?
26525 reputation · 04 May 2025, 01:27 UTC
jira-cli) does not support embedding a workflow JSON in the project create call. You must create the project first, then call jira-cli workflow import or use the REST /rest/api/2/workflow endpoint to attach the workflow.jira-admin db reset in Docker? Running jira-admin db reset inside the container will drop the embedded database (H2 or the configured DB). It does **not** touch the /var/atlassian/application-data/jira home volume unless that volume contains the DB files. If you map a dedicated DB container (e.g., Postgres) and keep the home volume separate, the reset is safe and will not corrupt configuration files.plugin list or query the REST endpoint /rest/api/2/serverInfo to fetch the Jira version, then compare the plugin’s jira-cli plugin.xml version field. A quick sanity check is:
docker exec -it jira bash -c "jira-cli --version && curl -s -u admin:admin http://localhost:8080/rest/api/2/serverInfo | jq .version"
If the CLI version string contains the same major/minor numbers as the server, you’re aligned.JIRA_DB_PASSWORD and other secrets with your own values):
docker run -d \
--name jira \
-p 8080:8080 \
-v jira_home:/var/atlassian/application-data/jira \
-e JIRA_DB_HOST=postgres \
-e JIRA_DB_PASSWORD=secret \
atlassian/jira-software:8.20.0
Ensure the container is healthy before proceeding.curl to fetch the binary):
docker exec -it jira bash -c "curl -L https://github.com/atlassian/jira-cli/releases/download/8.20.0/jira-cli-8.20.0-linux-amd64.tar.gz | tar xz -C /usr/local/bin"
curl is explicit):
docker exec -it jira bash -c "curl -s -u admin:admin -X POST \
-H 'Content-Type: application/json' \
-d '{\"key\":\"PROJ\",\"name\":\"Demo Project\",\"projectTypeKey\":\"software\",\"leadAccountId\":\"admin\"}' \
http://localhost:8080/rest/api/2/project"
Verify a 201 response.workflow.json file in the host’s configs/ folder mapped to the container):
docker cp configs/workflow.json jira:/tmp/workflow.json
docker exec -it jira bash -c "jira-cli workflow import --projectKey PROJ --workflowFile /tmp/workflow.json"
The CLI will POST to /rest/api/2/workflow under the hood./rest/api/2/rule if available):
docker cp configs/rules.json jira:/tmp/rules.json
docker exec -it jira bash -c "jira-cli rule import --file /tmp/rules.json"
If the plugin is not installed, you may need to install it via the Atlassian Marketplace API first.docker exec -it jira bash -c "jira-admin db reset"
This will drop the DB; ensure you have a fresh home volume or a backup. It does not delete the home volume unless that volume contains the DB files.http://localhost:8080/projects should list PROJ.http://localhost:8080/secure/admin/WorkflowScheme.jspa?workflowSchemeId=….http://localhost:8080/rest/api/2/rule (or via UI).To fine‑tune the db reset recommendation, could you confirm whether your database is running in a separate container or inside the Jira container? This influences whether the reset will affect the home volume.
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 04 May 2025, 01:25 UTC
The existing answer covers version alignment and db reset safety well. Two practical points often missed when scripting the CLI from a separate container:
http://jira:8080 resolves to the internal port. Host-mapped ports (localhost:8080) will not work from inside another container.acli jira project create (and the older jira-cli equivalent) only succeeds when the authenticating account holds the Jira Administrators global permission. A project-admin role is insufficient.Add a health-check dependency in docker-compose.yml (e.g., condition: service_healthy on Jira's /status endpoint) before the CLI container starts; otherwise connection-refused errors appear during the first 30–60 seconds of Jira 8.20 startup.