Skip to content

Show copy button for unsafe external URLs

Andrew Fontaine requested to merge afontaine/copy-non-http-links into master

What does this MR do and why?

We've recently loosened the verifiction of external URLs of environments to allow schemes other than http(s). When these links are used, navigating to them with a browser is not a good idea, but users might still need to copy them and paste them elsewhere, like for a database URL.

And so instead, when the link is unsafe, render a copy button.

Changelog: changed

Screenshots or screen recordings

image

image

image

How to set up and validate locally

  1. add the following .gitlab-ci.yml to a project for some deployments:
stages:
    - deploy
    - stop
image: alpine:latest

deploy-prod:
    stage: deploy
    script:
        - sleep 60
        - echo "deploying prod"
    environment:
        name: production
        url: postgres://production

deploy-staging:
    stage: deploy
    script:
        - echo "deploying staging"
    environment:
        name: staging
        url: https://example.com
    when: manual

deploy-review:
    stage: deploy
    script:
        - echo "Deploying review/$CI_COMMIT_REF_NAME"
    environment:
        name: review/$CI_COMMIT_REF_NAME
        auto_stop_in: 1 week
        url: postgres://review/$CI_COMMIT_REF_NAME
    only:
        - branches
    except:
        - main
    when: manual


stop_review_app:
  script: stop-review-app
  stage: stop
  environment:
    name: review/$CI_COMMIT_REF_SLUG
    action: stop
  rules:
    - if: $CI_MERGE_REQUEST_ID
      when: manual
  1. run a pipeline
  2. make an MR

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

For #367822 (closed)

Merge request reports

Loading