openSUSE / obs-service-go_modules

OBS Source Service to download, verify, and vendor Go module dependency sources
GNU General Public License v2.0
19 stars 18 forks source link

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

Open johanneskastl opened 1 year ago

johanneskastl commented 1 year ago
  <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 commented 1 year ago

The reason is that you fall into the following path first: https://github.com/openSUSE/obs-service-go_modules/blob/54cd3833dfd6475a4c643730e7a1ad84c6f678ba/go_modules#L94-L105

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 commented 1 year ago

I think this is a duplicate of #36

johanneskastl commented 9 months ago

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>