Incorrect Environment State is Rendered When Environment Variable Is Empty

https://gitlab.zendesk.com/agent/tickets/116970 (internal)

Summary

When the environment variable is empty

Steps to reproduce

  1. Create new environment
  2. Use an empty variable. In the example below, the URL below will be empty because nested variables are not supported
stages:
 - deploy

variables:
  APP: "My App"
  DEPLOY_NAME: $APP-master

deploy:
  stage: deploy
  script:
    - echo $DEPLOY_NAME
    - echo "here would be the script to deploy the app"
  environment:
    name: $CI_COMMIT_REF_NAME
    url: $DEPLOY_NAME
    on_stop: stopDeploy
  tags:
    - "update_tags"

stopDeploy:
  stage: deploy
  variables:
    GIT_STRATEGY: none
  script:
    - echo "here would be the script to stop the app"
  when: manual  
  environment:
    name: $CI_COMMIT_REF_NAME
    action: stop
  tags:
    - "update_tags"
  1. Stop the environments via UI
  • Head to Operations -> Environments. Click Stop
  1. Click the latest ID
  2. Observe that the state shows "Stopped"
  3. Click re-deploy
  4. Observe state showing Stopped, though the new state should be "Available"

Actual behavior

The wrong environment state is rendered

Expected behavior

When clicking re-deploy, it should show Available #{counter} and not Stopped #{counter}

What you should see instead

Stopped instead of Available

Relevant logs and/or screenshots

stopped-env. env-stopped-showing-stop-button

Used GitLab Runner version

11.9

Edited Mar 29, 2019 by Sara Ahbabou
Assignee Loading
Time tracking Loading