Skip to content
default.yml 889 B
Newer Older
stages:
  - .pre
  - build
  - test
  - post
  - security

.default:
  before_script:
      if [ "$CI_COMMIT_REF_PROTECTED" = true ] && [ -n "$CI_COMMIT_TAG" ]; then
        export APP_VERSION=$CI_COMMIT_TAG
      elif [ "$CI_COMMIT_REF_NAME" = "develop" ]; then
        export APP_VERSION="develop"
        # Replace '/' with '-' and check for any invalid characters
        APP_VERSION=$(echo "$CI_COMMIT_REF_NAME" | sed 's|/|-|g')
        
Kostis Trantzas's avatar
Kostis Trantzas committed
        # Check for invalid characters (only allow lowercase and uppercase letters, digits, '_', '.', '-')
        if echo "$APP_VERSION" | grep -q '[^a-zA-Z0-9._-]'; then
Kostis Trantzas's avatar
Kostis Trantzas committed
          echo "Error: Branch name contains invalid characters for Docker tags. Only a-z, A-Z, 0-9, '_', '.', and '-' are allowed."
Kostis Trantzas's avatar
Kostis Trantzas committed
        export APP_VERSION
    - echo "APP_VERSION set to $APP_VERSION"