workshopper icon indicating copy to clipboard operation
workshopper copied to clipboard

Calculate CONTENT_URL_PREFIX if not specified and 'content.url' not set in workshops file.

Open GrahamDumpleton opened this issue 6 years ago • 1 comments

If CONTENT_URL_PREFIX is not being set, but WORKSHOPS_URL is, and content.url is not set in the workshop file, calculate what CONTENT_URL_PREFIX would be by using the directory of the URI that specifies the location of the workshop file.

Thus if _workshop.yml file is just:

---
id: "starter-lab"
name: "Starter Lab"

modules:
  activate:
  - lab1

and WORKSHOPS_URL was:

https://someserver/some/path/_workshop.yml

for content.url use:

https://someserver/some/path

Further, if content.url does exist, but includes a relative filename path, append that to the end of the calculated location. Thus if had:

--
id: "starter-lab"
name: "Starter Lab"

content:
    url: ..

modules:
  activate:
  - lab1

would use:

https://someserver/some/path/..

or when normalised:

https://someserver/some

This would make it easier to avoid situations like:

  • https://github.com/openshift-labs/starter-guides/blob/ocp-3.11/_workshops/java-starter-guides.yml

where even though in ocp-3.11 branch it has:

content:
  url: https://raw.githubusercontent.com/openshift-labs/starter-guides/ocp-3.9

which forces people to fix it by setting CONTENT_URL_PREFIX.

That is, it points at ocp-3.9 when should be ocp-3.11. It could instead use .. for content.url and wouldn't have to worry then about it ever needing to be updated.

Note, if it is mean't to work like this in any way I am not seeing it, and get errors when content.url is not set or when putting . as value.

GrahamDumpleton avatar Feb 25 '19 07:02 GrahamDumpleton

cc @jorgemoralespou

GrahamDumpleton avatar Feb 25 '19 07:02 GrahamDumpleton