Skip to content

Add build step management commands (job step) #172

@tiulpin

Description

@tiulpin

Area: Configuration (parameters, projects)

Problem or use case

The CLI has a CreateBuildStep API method but no CLI commands for managing build steps. Build engineers (Journey 5) and agents setting up CI (Journey 2) need to add, view, and modify build steps. Currently the only option is raw API calls with complex JSON payloads:

# Current workaround — requires knowing the exact step JSON schema
teamcity api '/app/rest/buildTypes/id:MyBuild/steps' -X POST --input step.json

The job param subcommand group exists as a pattern — job step follows the same model.

Proposed solution

teamcity job step list <job-id>                                          # List all steps
teamcity job step view <job-id> <step-id>                                # View step details
teamcity job step add <job-id> --type <runner> --name "Step Name"        # Add a step
teamcity job step remove <job-id> <step-id>                              # Remove a step

Adding steps

# Command line runner
teamcity job step add MyBuild --type commandLine --name "Run Tests" \
  --param "script.content=./gradlew test"

# Gradle runner
teamcity job step add MyBuild --type gradle --name "Build" \
  --param "gradle.tasks=build" \
  --param "gradle.wrapper=true"

# Docker
teamcity job step add MyBuild --type docker --name "Build Image" \
  --param "docker.command.type=build"

Output:

$ teamcity job step list MyProject_Build

#   NAME           TYPE            STATUS
1   Compile        gradle          enabled
2   Run Tests      commandLine     enabled
3   Build Image    docker          disabled

Flags for job step add

  • --type (required) — runner type (commandLine, gradle, maven, docker, etc.)
  • --name — step name
  • --param — step parameter (repeatable, key=value)
  • --json — machine-readable output

Flags for job step list

  • --json — machine-readable output

API

Uses existing CreateBuildStep method and adds:

GetBuildSteps(buildTypeID string) (*BuildStepList, error)
GetBuildStep(buildTypeID, stepID string) (*BuildStep, error)
DeleteBuildStep(buildTypeID, stepID string) error

REST endpoints:

GET    /app/rest/buildTypes/id:<id>/steps
GET    /app/rest/buildTypes/id:<id>/steps/<step-id>
POST   /app/rest/buildTypes/id:<id>/steps
DELETE /app/rest/buildTypes/id:<id>/steps/<step-id>

Alternatives considered

  • Only manage steps via Kotlin DSL / versioned settings — doesn't work for server-only configurations, and agents need to make targeted edits without rewriting DSL
  • Add step management to teamcity api docs/skill only — payload complexity makes this impractical for agents

Contribution

  • I'd be willing to submit a PR for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:configConfiguration management (parameters, DSL, cleanup)enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions