I’ve added rollback workflows to my projects, however I can’t run them.
Whenever I click rollback in the UI, and fill in the necessary info, and click rollback, my browser makes an HTTP POST:
curl ‘https://bff.circleci.com/private/release-tracker/v1/project/REDACTED/rollback’ \
-X POST \
# headers redacted
–data-raw ‘{“environment_name”:“staging”,“component_name”:“gateway”,“current_version”:“0.8.84.39”,“target_version”:“0.8.84.36”,“namespace”:“”,“reason”:“Test rollback mechanism”,“parameters”:{}}’
But the response is always a HTTP 502:
{
"message":"An invalid response was received from the upstream server"
}
This happens for both projects that I’ve set up with similar but different rollback workflows. Here’s one such configuration:
version: 2.1
jobs:
rollback-component:
description: Tag component image for auto-deployment to an environment and poll its version endpoint until deployment is confirmed
environment:
COMPONENT: << pipeline.deploy.component_name >>
NAMESPACE: << pipeline.deploy.namespace >>
ENVIRONMENT: << pipeline.deploy.environment_name >>
TARGET_VERSION: << pipeline.deploy.target_version >>
docker:
- image: cimg/base:current
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
steps:
- run:
name: CircleCI plan deployments
command: circleci run release plan "$COMPONENT" --namespace="$NAMESPACE" --environment-name="$ENVIRONMENT" --component-name="$COMPONENT" --target-version="$TARGET_VERSION"
- run:
name: Authenticate to Dockerhub
command: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
- run:
name: CircleCI running deployment
command: circleci run release update "$COMPONENT" --status=RUNNING
- run:
name: Tag remote image with branch name to trigger auto-deployment
command: docker buildx imagetools create "${DOCKERHUB_USERNAME}/${COMPONENT}:${ENVIRONMENT}-${TARGET_VERSION}" --tag "${DOCKERHUB_USERNAME}/${COMPONENT}:${ENVIRONMENT}"
- run:
name: Wait for deployment confirmation
command: echo snipped for brevity
- run:
name: CircleCI successful deployment
when: on_success
command: circleci run release update "$COMPONENT" --status=SUCCESS
- run:
name: CircleCI failed deployment
when: on_fail
command: circleci run release update "$COMPONENT" --status=FAILED
cancel-rollback:
docker:
- image: cimg/base:current
steps:
- run:
name: Update planned release to CANCELED
command: circleci run release update --status=CANCELED
workflows:
rollback:
jobs:
- rollback-component:
context:
- dockerhub
- cancel-rollback:
requires:
- rollback-component:
- canceled