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

[Helm] Add logic to define BUILD_PATH based on '_service' file #945

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arsenalpoll
Copy link

This commit adds a block of code that checks if the _service directory exists. If it does, it parses the _service file to extract the filename and extract parameters. It then uses these values to define the BUILD_PATH.

@arsenalpoll arsenalpoll changed the title Add logic to define BUILD_PATH based on '_service' file [Helm] Add logic to define BUILD_PATH based on '_service' file Jul 25, 2023
@adrianschroeter
Copy link
Member

A source directory in build area that you parse as xml????

Sorry, this looks highly suspicious, did you execute it once at least?

@arsenalpoll
Copy link
Author

arsenalpoll commented Aug 8, 2023

A source directory in build area that you parse as xml????

Sorry, this looks highly suspicious, did you execute it once at least?

@adrianschroeter Hi, thank you very much for your reply.

This is my use example:

<services>
  <service name="obs_scm">
      <param name="scm">git</param>
      <param name="url">http://gitlab.xx.xx/abc/xyz.git</param>
      <param name="version">_none_</param>
      <param name="revision">origin/dev</param>
      <param name="filename">abc_xyz</param>
      <param name="extract">build/charts/crd/Chart.yaml</param>    
  </service>
</services>

Chart.yaml is extracted from the Git storage repository.
helm package command needs to be executed within the path where the Chart.yaml is located, so I added the specified path.

My example helm chart abc_xyz.tgz directory tree:

[root@arsenal ]# tree abc_xyz
abc_xyz
├── Chart.yaml
├── templates
│   ├── k8s.ovn.org_routes.yaml
│   ├── network-crd.yaml
│   └── subnet-crd.yaml
└── values.yaml

Content under the git repository path build/charts/crd/
image

BUILD_PATH=
if [ -d "$BUILD_ROOT/$TOPDIR/BUILD/_service" ]; then
# get the packaging file name
FILENAME=$(cat $BUILD_ROOT/$TOPDIR/BUILD/_service | xmllint --xpath 'string(//param[@name="filename"])' -)
Copy link
Member

Choose a reason for hiding this comment

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

you can not create a check that _service is a directory and afterwards reading it as an XML file.

also the "cat" command is quite pointless, you could add the file name to xmllint directly.

But what worries me most is that there should not be a source file in the BUILD directory at all, no?

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.

2 participants