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

Fix get_catalog.sh when runtime is snapshot #3755

Merged
merged 1 commit into from
Oct 20, 2022

Conversation

claudio4j
Copy link
Contributor

When the runtime is SNAPSHOT and uses a snapshot repository the downloaded artifact contains a timestamp which is not recognized when trying to move the file.

Release Note

NONE

When the runtime is SNAPSHOT and uses a snapshot repository
the downloaded artifact contains a timestamp which is not recognized
when trying to move the file.
Copy link
Contributor

@squakez squakez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure to understand when this is happening. In theory, we use snapshot only when a staging repository is provided, otherwise we should not use it. The -z $2 check is checking exactly that.

@claudio4j
Copy link
Contributor Author

claudio4j commented Oct 20, 2022

When building camel-k and referencing RUNTIME_VERSION=1.15.1-SNAPSHOT the mvn -q dependency:copy command downloads the file as camel-k-catalog-1.15.1-20221020.064800-11-catalog.yaml and the ./script/get_catalog.sh script fails with
mv: cannot stat './script/..//resources/camel-k-catalog-1.15.1-SNAPSHOT-catalog.yaml': No such file or directory
When the user provided a snapshot repo, it fails because the remote file doesn't contain the SNAPSHOT suffix in the file name, but contains the timestamp as camel-k-catalog-1.15.1-20221020.064800-11-catalog.yaml

@squakez
Copy link
Contributor

squakez commented Oct 20, 2022

When building camel-k and referencing RUNTIME_VERSION=1.15.1-SNAPSHOT the mvn -q dependency:copy command downloads the file as camel-k-catalog-1.15.1-20221020.064800-11-catalog.yaml and the ./script/get_catalog.sh script fails with mv: cannot stat './script/..//resources/camel-k-catalog-1.15.1-SNAPSHOT-catalog.yaml': No such file or directory When the user provided a snapshot repo, it fails because the remote file doesn't contain the SNAPSHOT suffix in the file name, but contains the timestamp as camel-k-catalog-1.15.1-20221020.064800-11-catalog.yaml

Just tested locally and it works as expected:

$ mvn -q dependency:copy -Dartifact="org.apache.camel.k:camel-k-catalog:1.12.1-SNAPSHOT:yaml:catalog" -DoutputDirectory=.
$ cat camel-k-catalog-1.12.1-SNAPSHOT-catalog.yaml 
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
...
apiVersion: camel.apache.org/v1
kind: CamelCatalog
metadata:
  name: camel-catalog-1.12.1-snapshot

@claudio4j
Copy link
Contributor Author

Probably there is already an artifact in $HOME/.m2/repository/org/apache/camel/k/camel-k-catalog/1.12.1-SNAPSHOT/ named with 1.12.1-SNAPSHOT in this case, remove that directory and try again, see the results when using a snapshot version downloaded from apache snapshot repo defined in settings.xml

[INFO] Configured Artifact: org.apache.camel.k:camel-k-catalog:catalog:1.12.1-SNAPSHOT:yaml
Downloading from apache-snapshots: https://repository.apache.org/snapshots/org/apache/camel/k/camel-k-catalog/1.12.1-SNAPSHOT/maven-metadata.xml
Downloaded from apache-snapshots: https://repository.apache.org/snapshots/org/apache/camel/k/camel-k-catalog/1.12.1-SNAPSHOT/maven-metadata.xml (1.0 kB at 750 B/s)
Downloading from apache-snapshots: https://repository.apache.org/snapshots/org/apache/camel/k/camel-k-catalog/1.12.1-SNAPSHOT/camel-k-catalog-1.12.1-20220309.050530-16-catalog.yaml
Downloaded from apache-snapshots: https://repository.apache.org/snapshots/org/apache/camel/k/camel-k-catalog/1.12.1-SNAPSHOT/camel-k-catalog-1.12.1-20220309.050530-16-catalog.yaml (90 kB at 76 kB/s)
[INFO] Copying camel-k-catalog-1.12.1-SNAPSHOT-catalog.yaml to /home/claudio/alphaworks/projects/camel-k/camel-k-catalog-1.12.1-20220309.050530-16-catalog.yaml

@squakez squakez merged commit 9cbbb81 into apache:main Oct 20, 2022
@claudio4j claudio4j deleted the fix_get-runtime branch October 20, 2022 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants