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

Cannot compile a component created with Docker named "component-name" #152

Closed
akosma opened this issue Jul 28, 2020 · 2 comments · Fixed by #153
Closed

Cannot compile a component created with Docker named "component-name" #152

akosma opened this issue Jul 28, 2020 · 2 comments · Fixed by #153
Labels
bug Something isn't working

Comments

@akosma
Copy link
Contributor

akosma commented Jul 28, 2020

When creating a component using the docker run commodore:v0.2.0 component new component-name command, the compilation does not work.

Steps to Reproduce the Problem

Follow the steps below:

  1. mkdir -p catalog inventory dependencies compiled
  2. docker run -i --rm --network=host --env-file=./.env --user="$(id -u)" --volume $PWD/catalog/:/app/catalog/ --volume $PWD/dependencies/:/app/dependencies/ --volume $PWD/inventory/:/app/inventory/ --volume ~/.ssh:/app/.ssh:ro --volume ~/.gitconfig:/app/.gitconfig:ro projectsyn/commodore:v0.2.0 catalog compile c-ancient-cherry-5082 --api-url=$LIEUTENANT_URL --api-token=$LIEUTENANT_TOKEN
  3. docker run -i --rm --user="$(id -u)" --volume ~/.ssh:/app/.ssh:ro --volume $PWD/catalog/:/app/catalog/ --volume $PWD/dependencies/:/app/dependencies/ --volume $PWD/inventory/:/app/inventory/ --volume ~/.gitconfig:/app/.gitconfig:ro projectsyn/commodore:v0.2.0 component new component-name
  4. docker run -i --rm --user="$(id -u)" --volume ~/.ssh:/app/.ssh:ro --volume $PWD/compiled/:/app/compiled/ --volume $PWD/catalog/:/app/catalog/ --volume $PWD/dependencies/:/app/dependencies/ --volume $PWD/inventory/:/app/inventory/ --volume ~/.gitconfig:/app/.gitconfig:ro projectsyn/commodore:v0.2.0 component compile dependencies/component-name

Actual Behavior

Error: Could not find component class file: /app/dependencies/component-name/class/name.yml

Expected Behavior

I expect the component to compile normally. This error does not happen if the component name is not component-name.

@akosma akosma added the bug Something isn't working label Jul 28, 2020
@simu
Copy link
Member

simu commented Jul 28, 2020

Root cause appears to be that we ignore the component- prefix in the directory name, if it exists, cf.

# Ignore 'component-' prefix in dir name
component_name = component_path.stem.replace('component-', '')

IIRC, this behavior was implemented because we add the prefix component- to the Git repository for the component on GitHub, e.g. the component in https://github.com/projectsyn/component-metrics-server/ is named metrics-server.

cc @srueg

@srueg
Copy link
Contributor

srueg commented Jul 28, 2020

Yes exactly. The idea was to support both variants: check-outs of components in directories with and without the component- prefix. If a component is manually cloned, it will be in a directory with the prefix. If Commodore clones the repo, it won't have the prefix.

A quick fix would be to forbid the component- prefix in component names (in the component new command).

srueg pushed a commit that referenced this issue Jul 29, 2020
Prevent components having the `component-` prefix in their slug.

Closes #152
@srueg srueg mentioned this issue Jul 29, 2020
4 tasks
srueg pushed a commit that referenced this issue Jul 29, 2020
Prevent components having the `component-` prefix in their slug.

Closes #152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants