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

Fails to vendor kubeconfig-merger because it does not find the go.mod file? #42

Open
johanneskastl opened this issue Nov 21, 2023 · 3 comments

Comments

@johanneskastl
Copy link

johanneskastl commented Nov 21, 2023

  <service name="obs_scm" mode="manual">
    <param name="url">https://github.com/QJoly/kubeconfig-merger</param>
    <param name="scm">git</param>
    <param name="exclude">.git</param>
    <param name="revision">v0.1.0</param>
    <param name="versionformat">@PARENT_TAG@</param>
    <param name="changesgenerate">enable</param>
    <param name="versionrewrite-pattern">v(.*)</param>
  </service>
  <service name="set_version" mode="manual">
  </service>
  <service name="tar" mode="buildtime"/>
  <service name="recompress" mode="buildtime">
    <param name="file">*.tar</param>
    <param name="compression">gz</param>
  </service>
  <service name="go_modules" mode="manual">
    <param name="subdir">None</param>
  </service>
</services>
merge: origin/v0.1.0 - not something we can merge
Already up to date.
4d64392b63ce2e4cede372c6376e5ccea9ed7489
INFO:obs-service-go_modules:Running OBS Source Service: obs-service-go_modules
INFO:obs-service-go_modules:Autodetecting archive since no archive param provided in _service
DEBUG:obs-service-go_modules:Trying to find archive name with pattern kubeconfig-merger*.tar.gz
DEBUG:obs-service-go_modules:Trying to find archive name with pattern kubeconfig-merger*.tar.xz
DEBUG:obs-service-go_modules:Trying to find archive name with pattern kubeconfig-merger*.tar.zst
DEBUG:obs-service-go_modules:Trying to find archive name with pattern kubeconfig-merger*.tar.lz
DEBUG:obs-service-go_modules:Trying to find archive name with pattern kubeconfig-merger*.tar.bz2
DEBUG:obs-service-go_modules:Trying to find archive name with pattern kubeconfig-merger*.obscpio
INFO:obs-service-go_modules:Archive autodetected at /home/Buildservice/Branches/Branch_devel_kubic/kubeconfig-merger/kubeconfig-merger-0.1.0.obscpio
INFO:obs-service-go_modules:Using archive kubeconfig-merger-0.1.0.obscpio
INFO:obs-service-go_modules:Extracting kubeconfig-merger-0.1.0.obscpio to /tmp/tmpru43howu
INFO:obs-service-go_modules:Switching to /tmp/tmpru43howu
INFO:obs-service-go_modules:Detected basename kubeconfig-merger-0.1.0/examples from archive
ERROR:obs-service-go_modules:File go.mod not found under /tmp/tmpru43howu/kubeconfig-merger-0.1.0/examples
Aborting: service call failed:  /usr/lib/obs/service/go_modules --subdir None --outdir /home/Buildservice/Branches/Branch_devel_kubic/kubeconfig-merger/tmp8zgay050.go_modules.service

Not sure why it is looking in the examples subdirectory?

@SchoolGuy
Copy link

SchoolGuy commented Nov 23, 2023

The reason is that you fall into the following path first:

def basename_from_archive(archive_name):
paths = []
with libarchive.file_reader(archive_name) as archive:
for entry in archive:
if entry.isdir:
paths.append(entry.name)
try:
basename = os.path.commonpath(paths)
except ValueError:
return
log.info(f"Detected basename {basename} from archive")
return basename

This detection is so trivial that it finds the wrong folder IMHO.

In my case this finds the .github folder of the project:

┬─[enno@tower:~/S/E/h/node-semver]─[16:00:32]
╰─>$ osc service mr
Already up to date.
2f63e48a80857993b9dfa5139c801650eb694d3b
INFO:obs-service-go_modules:Running OBS Source Service: obs-service-go_modules
INFO:obs-service-go_modules:Using archive /home/enno/Sources/External-Build-Service/home:SchoolGuy:jitsi/node-semver/node-semver-0.0.0.1639577940.2f63e48.obscpio
INFO:obs-service-go_modules:Extracting /home/enno/Sources/External-Build-Service/home:SchoolGuy:jitsi/node-semver/node-semver-0.0.0.1639577940.2f63e48.obscpio to /tmp/tmpiwrnryzk
INFO:obs-service-go_modules:Switching to /tmp/tmpiwrnryzk
INFO:obs-service-go_modules:Detected basename node-semver-0.0.0.1639577940.2f63e48/.github from archive
ERROR:obs-service-go_modules:File go.mod not found under /tmp/tmpiwrnryzk/node-semver-0.0.0.1639577940.2f63e48/.github
Aborting: service call failed:  /usr/lib/obs/service/go_modules --compression zst --archive node-semver-*.obscpio --outdir /home/enno/Sources/External-Build-Service/home:SchoolGuy:jitsi/node-semver/tmpvxc0hk9s.go_modules.service

@SchoolGuy
Copy link

I think this is a duplicate of #36

@johanneskastl
Copy link
Author

I could workaround by excluding the examples directory.

<services>
  <service name="obs_scm" mode="manual">
    <param name="url">https://github.com/QJoly/kubeconfig-merger</param>
    <param name="scm">git</param>
    <param name="exclude">.git</param>
    <param name="exclude">examples</param>
    <param name="revision">v0.1.0</param>
    <param name="versionformat">@PARENT_TAG@</param>
    <param name="changesgenerate">enable</param>
    <param name="versionrewrite-pattern">v(.*)</param>
  </service>
  <service name="set_version" mode="manual">
  </service>
  <service name="tar" mode="buildtime"/>
  <service name="recompress" mode="buildtime">
    <param name="file">*.tar</param>
    <param name="compression">gz</param>
  </service>
  <service name="go_modules" mode="manual">
  </service>
</services>

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

No branches or pull requests

2 participants