-
Notifications
You must be signed in to change notification settings - Fork 201
Open
Description
In the following OBS project config, pbuild does not automatically detect the presence of a Dockerfile.dapper file in the package source:
%if %_repository == "example-repo"
Type: docker
BuildEngine: docker
...
%endifAlthough, changing Type: docker to Type: dapper makes OBS detect Dockerfile.dapper as the build recipe:
%if %_repository == "example-repo"
Type: dapper
BuildEngine: docker
...
%endifThis appears to work by accident, since Type: dapper is not a valid value.
I further tested with any random Type: abc which also made OBS pick up any file matching *.abc in the package source as a build recipe. This seems to be a bug or unintended behaviour.
The current implementation for finding the build recipe, (i) either via the configured Type: or (ii) via auto-detection - is present here and may require an update:
Lines 41 to 65 in df3ab84
| return $files{'Dockerfile'} if $type eq 'docker' && $files{'Dockerfile'}; | |
| return $files{'fissile.yml'} if $type eq 'fissile' && $files{'fissile.yml'}; | |
| return $files{'Chart.yaml'} if $type eq 'helm' && $files{'Chart.yaml'}; | |
| return (grep {/flatpak\.(?:ya?ml|json)$/} sort keys %files)[0] if $type eq 'flatpak'; | |
| return $files{'PKGBUILD'} if $type eq 'arch' && $files{'PKGBUILD'}; | |
| return $files{'APKBUILD'} if $type eq 'apk' && $files{'APKBUILD'}; | |
| my $pkg = $p->{'pkg'}; | |
| $pkg = $p->{'flavor'} if $p->{'flavor'}; | |
| return $files{"Dockerfile.$pkg"} if $type eq 'docker' && $files{"Dockerfile.$pkg"}; | |
| return $files{"$pkg.$type"} if $files{"$pkg.$type"}; | |
| # try again without last components | |
| return $files{"$1.$type"} if $pkg =~ /^(.*?)\./ && $files{"$1.$type"}; | |
| my @files = grep {/\.$type$/} keys %files; | |
| @files = grep {/^\Q$pkg\E/i} @files if @files > 1; | |
| return $files{$files[0]} if @files == 1; | |
| if (@files > 1) { | |
| @files = sort @files; | |
| return $files{$files[0]}; | |
| } | |
| return $files{'debian.control'} if $type eq 'dsc' && $files{'debian.control'}; | |
| return $files{'debian/control'} if $type eq 'dsc' && $files{'debian/control'}; | |
| # as last resort ignore the type for image/container building | |
| if ($type ne 'docker') { | |
| return $files{'Dockerfile'} if $files{'Dockerfile'}; | |
| return $files{"Dockerfile.$pkg"} if $files{"Dockerfile.$pkg"}; |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels