Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container Location regex: need to support additional segments or domains. #128

Open
elenaviter opened this issue Dec 7, 2023 · 3 comments
Labels
feature-request New feature or request that needs to be turned into Epic/Story details needs-triage Needs looking at to decide what to do

Comments

@elenaviter
Copy link
Contributor

Description

Scope

Ability to configure, in Stacks, images from the private artifactory which could have complex data organization structure.

Details

Existing Container Location regex works fine with regular domain/subdomain:version formats of docker image location.

However it does not work for data organization in our artifactory.
Example of the url that does work:

  • dc-if/flowforge/node-red:1.13.3

Examples of the location string which does not work:

  • {COMPANY}.jfrog.io/tenant-dev/dc-if/flowforge/node-red:1.13.3
  • {tenant-dev/dc-if/flowforge/node-red:1.13.3

Suggestion

@hardillb could you have a look on regex like this to use?
'^([a-z0-9][a-z0-9\\-]*(\\.[a-z0-9\\-]+)*\\/)+[a-z0-9\\-]+(?:\\/[a-z0-9\\-]+)*(?::[0-9]+\\.[0-9]+\\.[0-9]+)?$'

let validate = '^([a-z0-9][a-z0-9\\-]*(\\.[a-z0-9\\-]+)*\\/)+[a-z0-9\\-]+(?:\\/[a-z0-9\\-]+)*(?::[0-9]+\\.[0-9]+\\.[0-9]+)?$';
let validator = new RegExp(validate);

let val1 = "aiola.jfrog.io/aiola-dev/dc-if/flowforge/node-red:1.13.3";
let val2 = "dc-if/flowforge/node-red:1.13.3";
let val3 = "aiola-dev/dc-if/flowforge/node-red:1.13.3";
let val4 = "flowforge/node-red:1.13.3";

console.log(validator.test(val1)); // Should be true
console.log(validator.test(val2)); // Should be true
console.log(validator.test(val3)); // Should be true
console.log(validator.test(val4)); // Should be true
@elenaviter elenaviter added feature-request New feature or request that needs to be turned into Epic/Story details needs-triage Needs looking at to decide what to do labels Dec 7, 2023
@hardillb
Copy link
Contributor

Hi @elenaviter support for more docker container repositories is a good idea, but this new regex only matches semver tags, it wouldn't match:

  • flowforge/node-red:latest
  • flowforge/node-red:nightly
  • flowforge/node-red:1.14.0-beta

Needs a little bit more work

@elenaviter
Copy link
Contributor Author

Hi @hardillb
True.
What about this?

let validate = '^([a-z0-9][a-z0-9\\-]*(\\.[a-z0-9\\-]+)*\\/)+[a-z0-9\\-]+(?:\\/[a-z0-9\\-]+)*(?::[a-z0-9\\-\\.]+[a-z0-9\\-\\.]*[a-z0-9\\-\\.]+)?$';
let validator = new RegExp(validate);

let val1 = "aiola.jfrog.io/aiola-dev/dc-if/flowforge/node-red:1.13.3";
let val2 = "dc-if/flowforge/node-red:1.13.3";
let val3 = "aiola-dev/dc-if/flowforge/node-red:1.13.3";
let val4 = "flowforge/node-red:1.13.3";
let val5 = "flowforge/node-red:latest";
let val6 = "flowforge/node-red:nightly";
let val7 = "flowforge/node-red:1.14.0-beta";

console.log(validator.test(val1)); // Should be true
console.log(validator.test(val2)); // Should be true
console.log(validator.test(val3)); // Should be true
console.log(validator.test(val4)); // Should be true
console.log(validator.test(val5)); // Should be true
console.log(validator.test(val6)); // Should be true
console.log(validator.test(val7)); // Should be true

@hardillb
Copy link
Contributor

@elenaviter sorry for the delay in getting back to you.

Yes that looks good, if you can do a PR for both this and the Docker driver to keep them in sync I'll get it merged as soon a possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request that needs to be turned into Epic/Story details needs-triage Needs looking at to decide what to do
Projects
Status: No status
Development

No branches or pull requests

2 participants