More About Archive Expansion Behavior During Codebase Uploads
Code Insight 2020 R3
The following topics describe important information about how archives are expanded when a codebase is uploaded
• | Retention of the Original Archive Files |
• | Expansion of Archives Containing an Intermediary .tar File |
• | Multiple Codebase Uploads to the Same Project |
Retention of the Original Archive Files
The extraction of an archive’s contents occurs in a folder (with the archive’s name) directly under the parent folder. The archive itself is retained in the parent folder. For example, suppose the archive AppsSport.zip is located in the coreApps directory in your codebase. The AppsSport.zip archive contains the files hockey1.exe and tennis.exe. When AppsSport.zip is expanded, the resulting codebase tree looks like this, where both AppsSport.zip and a folder AppsSport, containing the archive contents, are found directly under coreApps:
coreApps
---AppsSport
-----hockey1.exe
-----tennis1.exe
---AppsSport.zip
Note:The uploadProjectCodebase REST API provides an option to remove those archives whose contents have been expanded during an upload. (The archive is removed from the uploaded codebase after the upload is finished.) The API also allows you to define a suffix to add to the name of any folder automatically created during the upload to store an archive’s contents. Once the codebase is scanned, the suffix helps you to easily identify those folders in the codebase tree whose contents are from an archive. Currently, neither of these options are available in the Web UI.
Expansion of Archives Containing an Intermediary .tar File
The .tar.gz, .tgz, .txz, and .tar.xz archive types and similar archives contain an intermediary .tar archive. The codebase upload extracts the intermediary .tar file from the archive, but applies the Archive Expansion Options configuration starting with the expansion of the intermediary .tar file, not the initial archive. The following example demonstrates this expansion behavior.
Suppose the archive jars.tar.gz has these contents, where the intermediary file is jar.tar:
jars.tar.gz
--jars.tar
----file-1.txt
----file-2.txt
----jar.zip
------abc.jar (color)
------xyz.jar
------classes.zip
--------corporation.class
--------employee.class
The uploaded codebase looks like this if the None option for Archive Expansion Options is applied. The jars.tar is extracted from jars.tar.gz. The jars.tar archive is then expanded, but the jar.zip file (contained in jars.tar) is not expanded. Keep in mind that the original archive files are retained.
file-1.txt
file-2.txt
jar.zip
The uploaded codebase looks like this if the Uploaded file and first-level archives only option for Archive Expansion Options is used. The jars.tar is extracted from the initial jars.tar.gz. Once the jars.tar archive is expanded, the first-level jar.zip file (contained in jars.tar) is also expanded. However, the second-level classes.zip (contained in jar.zip) is not expanded.
file-1.txt
file-2.txt
\jar
---abc.jar
---xyz.jar
---classes.zip
jar.zip
The uploaded codebase looks like this if the Uploaded file and all contained archives option for Archive Expansion Options is used. The jars.tar is extracted from the initial jars.tar.gz. Once jars.tar archive is expanded, the first-level jar.zip file and the second-level classes.zip file are also expanded.
jars.tar
file-1.txt
file-2.txt
\jar
---abc.jar
---xyz.jar
---\classes
------Corporation.class
------Employee.class
---classes.zip
jar.zip
Multiple Codebase Uploads to the Same Project
If multiple codebases are uploaded to the same codebase path for a given project (and existing codebase files are not deleted), the archives within all the codebases for the project are expanded based on the current Archive Expansion Options configuration. The following process demonstrates this behavior:
1. | Create project1 and upload the codebase codefiles1.zip, using the None option. The contents of codefile1.zip are extracted. Archives in these contents are not expanded. |
2. | Upload codefile2.zip to the same project (at the same codebase path), this time using the Uploaded file and all contained archives. (Keep in mind that codebase1.zip was previously expanded with no further expansion of any archives in its contents.) Now all archives at all levels are expanded within the codefile1 and codefile2 codebases. |
3. | Upload codefile3.zip to the same project, this time using Uploaded file and first-level archives only. Now only the first-level archives in all three codebases are expanded. |
If you upload multiple codebases to the same project, best practice is to keep track of the Archive Expansion Options configuration for each upload so that you can apply an appropriate configuration for the subsequent upload.