Projects with "type": "zip" are extracted to a subpath, breaking devfiles
See original GitHub issueDescribe the bug
Since https://github.com/eclipse/che/issues/14206 is resolved, Theia can handle projects downloaded as zips. However, typically zips (e.g. from github) unzip to a folder including the branch name, which causes the project to be unzipped to a subpath – e.g.
/projects/console-java-simple/console-java-simple-master
instead of
/projects/console-java-simple/
This breaks many devfile commands that depend on the project being in a known location.
Che version
- nightly
Steps to reproduce
Start a workspace using the devfile
metadata:
name: zip-project
projects:
- name: console-java-simple
source:
location: 'https://github.com/che-samples/console-java-simple/archive/master.zip'
type: zip
components:
- id: redhat/java11/latest
type: chePlugin
- mountSources: true
memoryLimit: 512Mi
type: dockerimage
volumes:
- name: m2
containerPath: /home/user/.m2
image: 'quay.io/eclipse/che-java11-maven:nightly'
alias: maven
env:
- value: /home/user/.m2
name: MAVEN_CONFIG
- value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/user
name: MAVEN_OPTS
- value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom
name: JAVA_OPTS
- value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom
name: JAVA_TOOL_OPTIONS
apiVersion: 1.0.0
commands:
- name: maven build
actions:
- workdir: '${CHE_PROJECTS_ROOT}/console-java-simple'
type: exec
command: mvn clean install
component: maven
- name: maven build and run
actions:
- workdir: '${CHE_PROJECTS_ROOT}/console-java-simple'
type: exec
command: mvn clean install && java -jar ./target/*.jar
component: maven
Expected behavior
Project is unzipped to the correct folder.
Runtime
- OpenShift 3.11
Screenshots
Additional Context
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
How can I expand only a particular subdirectory of a zipTree?
If I want files d and e to be copied to another folder, I have to copy the entirety of file.zip to a...
Read more >Extract files from zip without keeping the structure using ...
This opens file handles of members of the zip archive, extracts the filename and copies it to a target file (that's how ZipFile.extract...
Read more >ExtractFiles@1 - Extract files v1 task | Microsoft Learn
Use this task to extract a variety of archive and compression files, such as .7z, .rar, .tar.gz, and .zip. Syntax. YAML Copy.
Read more >Python's zipfile: Manipulate Your ZIP Files Efficiently
In this guided tutorial, you'll learn how to manipulate ZIP files using Python's zipfile module from the standard library.
Read more >How can I force unzip / zip not to create a subdirectory when I ...
Stripping the version number from your project sources is a bad idea; you should just extract normally and use a ln -s if...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@amisevsk @ibuziuk you can use
git archive
instead ofzip
.PR open https://github.com/eclipse/che-devfile-registry/pull/127
@akurinnoy with the changes in the PR, no changes to the factory plugin are required.