Skip to content

Commit a99e31a

Browse files
rodrigo-sobraletejedor
authored andcommitted
swancustomenvironments: Allow URLs with multiple subfolders
Accept URLs like `ssh://git@gitlab.cern.ch:7999/acc-co/devops/python/acc-py-examples/python-package.git` and `https://gitlab.cern.ch/acc-co/devops/python/acc-py-examples/python-package.git`
1 parent 64eca63 commit a99e31a

File tree

1 file changed

+3
-2
lines changed
  • SwanCustomEnvironments/swancustomenvironments/scripts

1 file changed

+3
-2
lines changed

SwanCustomEnvironments/swancustomenvironments/scripts/makenv.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ done
146146
# Validate input arguments
147147

148148
# Git URL pattern: https://github.com/<username>/<repo_name>(/?) or https://gitlab.cern.ch/<username>/<repo_name>((/?)|(.git?))
149-
REPO_HTTP_PATTERN="^https?://(github\.com|gitlab\.cern\.ch)/[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+(/|\.git)?$"
150-
REPO_SSH_PATTERN="^(ssh://git@(gitlab\.cern\.ch)(:[0-9]+)?/|git@github\.com:)[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+(/|\.git)?$"
149+
REPO_HTTP_PATTERN="^https?://(github\.com|gitlab\.cern\.ch)(/[a-zA-Z0-9._-]+)+(/|\.git)?$"
150+
# SSH URL pattern: ssh://<username>@<hostname>:<port>/<repo_path> or <username>@<hostname>:<repo_path> (scp-style)
151+
REPO_SSH_PATTERN="^(ssh://git@(gitlab\.cern\.ch)(:[0-9]+)?/|git@github\.com:)([a-zA-Z0-9._-]+/)+[a-zA-Z0-9._-]+(/|\.git)?$"
151152

152153
# Checks if the provided repository is a valid URL
153154
if [[ "$REPOSITORY" =~ $REPO_HTTP_PATTERN || "$REPOSITORY" =~ $REPO_SSH_PATTERN ]]; then

0 commit comments

Comments
 (0)