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

Support also "Containerfile" for docker container builds #960

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Build.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,7 @@ sub recipe2buildtype {
return 'collax' if $recipe eq 'build.collax';
return 'snapcraft' if $recipe eq 'snapcraft.yaml';
return 'appimage' if $recipe eq 'appimage.yml';
return 'docker' if $recipe eq 'Containerfile' || $recipe =~ /^Containerfile\..*/;
return 'docker' if $recipe eq 'Dockerfile' || $recipe =~ /^Dockerfile\..*/;
return 'fissile' if $recipe eq 'fissile.yml';
return 'preinstallimage' if $recipe eq '_preinstallimage';
Expand Down
2 changes: 1 addition & 1 deletion PBuild/Job.pm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ sub collect_result {
}
@d = ('ARCHPKGS') if $p->{'recipe'} =~ /PKGBUILD$/;
@d = ('KIWI') if $p->{'recipe'} =~ /\.kiwi$/;
@d = ('DOCKER') if $p->{'recipe'} =~ /Dockerfile(\.|$)/;
@d = ('DOCKER') if $p->{'recipe'} =~ /(Docker|Container)file(\.|$)/;
@d = ('FISSILE') if $p->{'recipe'} =~ /fissile\.yml$/;
@d = ('HELM') if $p->{'recipe'} =~ /Chart\.yaml$/;
push @d, 'OTHER';
Expand Down
8 changes: 6 additions & 2 deletions PBuild/Recipe.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ sub find_recipe {
return $files{'simpleimage'} if $files{'simpleimage'};
return $files{'snapcraft.yaml'} if $type eq 'snapcraft' && $files{'snapcraft.yaml'};
return $files{'appimage.yml'} if $type eq 'appimage' && $files{'appimage.yml'};
return $files{'Containerfile'} if $type eq 'docker' && $files{'Containerfile'};
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'} ? $files{'PKGBUILD'} : undef if $type eq 'arch';
my $pkg = $p->{'pkg'};
$pkg = $p->{'flavor'} if $p->{'flavor'};
return $files{"Containerfile.$pkg"} if $type eq 'docker' && $files{"Containerfile.$pkg"};
return $files{"Dockerfile.$pkg"} if $type eq 'docker' && $files{"Dockerfile.$pkg"};
return $files{"$pkg.$type"} if $files{"$pkg.$type"};
# try again without last components
Expand All @@ -60,7 +62,9 @@ sub find_recipe {
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{'Containerfile'} if $files{'Containerfile'};
return $files{'Dockerfile'} if $files{'Dockerfile'};
return $files{"Containerfile.$pkg"} if $files{"Containerfile.$pkg"};
return $files{"Dockerfile.$pkg"} if $files{"Dockerfile.$pkg"};
}
if ($type ne 'kiwi') {
Expand Down Expand Up @@ -204,9 +208,9 @@ sub looks_like_packagedir {
return 0 if grep {/^_build\./} @files;
for my $file (@files) {
return 1 if $file =~ /\.(?:spec|dsc|kiwi)$/;
return 1 if $file =~ /^(?:Dockerfile|mkosi)\./;
return 1 if $file =~ /^(?:Containerfile|Dockerfile|mkosi)\./;
return 1 if $file eq 'snapcraft.yaml' || $file eq 'appimage.yml';
return 1 if $file eq 'Dockerfile' || $file eq 'fissile.yml' || $file eq 'Chart.yml';
return 1 if $file eq 'Containerfile' || $file eq 'Dockerfile' || $file eq 'fissile.yml' || $file eq 'Chart.yml';
return 1 if $file eq 'PKGBUILD';
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions build-recipe
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ recipe_set_buildtype() {
PKGBUILD) BUILDTYPE=arch ;;
snapcraft.yaml) BUILDTYPE=snapcraft ;;
appimage.yml) BUILDTYPE=appimage ;;
Dockerfile|Dockerfile.*) BUILDTYPE=docker ;;
Containerfile|Containerfile.*|Dockerfile|Dockerfile.*) BUILDTYPE=docker ;;
fissile.yml) BUILDTYPE=fissile ;;
build.collax) BUILDTYPE=collax ;;
_preinstallimage) BUILDTYPE=preinstallimage ;;
Expand Down Expand Up @@ -191,7 +191,7 @@ expand_recipe_directories() {
mkosi) types="mkosi." ;;
esac
fi
types="$types .spec _specsubdir:package _specsubdir:dist .dsc PKGBUILD Dockerfile build.collax .kiwi .src.rpm .nosrc.rpm simpleimage snapcraft.yaml Chart.yaml flatpak.yaml flatpak.json mkosi."
types="$types .spec _specsubdir:package _specsubdir:dist .dsc PKGBUILD Containerfile Dockerfile build.collax .kiwi .src.rpm .nosrc.rpm simpleimage snapcraft.yaml Chart.yaml flatpak.yaml flatpak.json mkosi."
fi
for t in $types ; do
found=
Expand Down
2 changes: 1 addition & 1 deletion download_assets
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ for my $dir (@dirs) {
find_assets($assetmgr, $bconf, $p, $opts->{'recipe'});
} else {
for my $file (sort keys %$files) {
next unless $file eq 'sources' || $file eq 'go.sum' || $file eq 'PKGBUILD' || $file eq 'Dockerfile' || $file =~ /^Dockerfile\./ || $file =~ /\.(?:spec|dsc|kiwi)/;
next unless $file eq 'sources' || $file eq 'go.sum' || $file eq 'PKGBUILD' || $file eq 'Containerfile'|| $file eq 'Dockerfile' || $file =~ /^(?:Container|Docker)file\./ || $file =~ /\.(?:spec|dsc|kiwi)/;
find_assets($assetmgr, $bconf, $p, $file);
}
}
Expand Down