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

OBS fails to resolve correctly for zypper calls using exec form #926

Open
SchoolGuy opened this issue Apr 3, 2023 · 2 comments
Open

OBS fails to resolve correctly for zypper calls using exec form #926

SchoolGuy opened this issue Apr 3, 2023 · 2 comments

Comments

@SchoolGuy
Copy link

Issue Description

Containers built with a Dockerfile and the exec-form for the RUN command don't have the packages asked for available. When switching to the shell form it works as expected.

Expected Result

The packages installed using the exec-form of zypper should be recognized and available during the build.

How to Reproduce

FROM opensuse/tumbleweed

# Works
RUN zypper in -n apache2

# Doesn't work
RUN ["zypper", "in", "-n", "python3-distro"]
  1. Use provided Dockerfile and build in OBS/IBS
  2. See error described above

Further Information

Project where this can be seen (revision 3): https://build.opensuse.org/package/show/home:cobbler-project:github-ci:release32/cobbler-docker-testing

@SchoolGuy
Copy link
Author

SchoolGuy commented Apr 3, 2023

In the meantime, I committed revision 4 which is building with (relative - only x86_64) success.

@SchoolGuy
Copy link
Author

A little bird (@Vogtinator) told me that this is actually a bug in obs-build. Feel free to move the issue.

It seems to be an issue with the following script:

obs-build/Build/Docker.pm

Lines 345 to 367 in df01e0c

} elsif ($cmd eq 'RUN') {
$line =~ s/#.*//; # get rid of comments
for my $l (split(/(?:\||\|\||\&|\&\&|;|\)|\()/, $line)) {
$l =~ s/^\s+//;
$l =~ s/\s+$//;
$l = expandvars($l, $vars) if $l =~ /\$/;
@args = split(/[ \t]+/, $l);
s/%([a-fA-F0-9]{2})/chr(hex($1))/ge for @args;
next unless @args;
my $rcmd = shift @args;
$rcmd = shift @args if @args && ($rcmd eq 'then' || $rcmd eq 'else' || $rcmd eq 'elif' || $rcmd eq 'if' || $rcmd eq 'do');
if ($rcmd eq 'zypper') {
cmd_zypper($ret, @args);
} elsif ($rcmd eq 'yum' || $rcmd eq 'dnf') {
cmd_dnf($ret, @args);
} elsif ($rcmd eq 'apt-get') {
cmd_apt_get($ret, @args);
} elsif ($rcmd eq 'curl') {
cmd_curl($ret, @args);
} elsif ($rcmd eq 'obs_pkg_mgr') {
cmd_obs_pkg_mgr($ret, @args);
}
}

@hennevogel hennevogel transferred this issue from openSUSE/open-build-service Apr 4, 2023
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

1 participant