Changeset 2463 in ProjectBuilder
- Timestamp:
- Jan 18, 2020, 6:27:50 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r2459 r2463 2649 2649 # pbimage is used for docker and is setup to the right name depending on the step: 2650 2650 # TODO: This is not coded yet 2651 my $pbimage = undef;2652 2651 # step 0 : nothing at creation -> tag n-v-a (made in VE.pm) 2653 2652 # step 1 : n-v-a + setup -> tag n-v-a-pb … … 2661 2660 $tag{2} = "$tag{1}-pb"; 2662 2661 $tag{3} = "$tag{2}-$ENV{'PBPROJ'}"; 2663 $tag{4} = "$tag{2}-install -$ENV{'PBPROJ'}";2664 $tag{5} = "$tag{2}-test -$ENV{'PBPROJ'}";2662 $tag{4} = "$tag{2}-install"; 2663 $tag{5} = "$tag{2}-test"; 2665 2664 } else { 2666 2665 # If we were given an image name, just use it … … 2674 2673 # TODO: we don't do anything with found !! 2675 2674 my $found = pb_ve_docker_get_image($tag{$pbstep}); 2675 my $origimage = undef; 2676 if (($pbstep > 3) && (not defined $found)) { 2677 # initiate these images from the last n-v-a-pb-pbproj below 2678 $found = 0; 2679 $origimage = "$tag{3}"; 2680 } else { 2681 $origimage = "$tag{$pbstep}"; 2682 } 2676 2683 cluck "No image $tag{$pbstep} available in Docker, please create one first\n" if (not defined $found); 2677 2684 # Now we use that image to do what is needed … … 2680 2687 my $tmpd = "$context/Dockerfile"; 2681 2688 open(DOCKER, "> $tmpd") || confess "Unable to create the docker file $tmpd"; 2682 print DOCKER "FROM $ tag{$pbstep}\n";2689 print DOCKER "FROM $origimage\n"; 2683 2690 print DOCKER "MAINTAINER project-builder.org aka pb\n"; 2684 2691 if ($pbstep == 1) { … … 2690 2697 } 2691 2698 print DOCKER "USER $dkaccount\n"; 2692 if (($pbstep <= 2) || ($pbstep > 3)) { 2699 my $rmatend = ""; 2700 # As we are in run phase use docker run. cmd will be completed below 2701 $rmatend = "--rm" if ($pbdebug lt 1); 2702 if ($pbstep <= 2) { 2693 2703 $shcmd = "$cmd1 build -t $tag{$pbstep+1} $context"; 2694 2704 #$shcmd = "$cmd1 build $dockeropt->{$ENV{'PBPROJ'}} -t $tag{$pbstep+1} $context"; 2705 } elsif ($pbstep > 3) { 2706 # We force the destruciton of the image before recreating it for install or test 2707 $shcmd = "$cmd1 rmi $tag{$pbstep} ; "; 2708 $shcmd .= "$cmd1 build -t $tag{$pbstep} $context ; "; 2709 $shcmd .= "$cmd1 run $rmatend --cidfile=\"$cidfile\" --user $dkaccount --name $pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}-$cmt "; 2695 2710 } else { 2696 my $rmatend = ""; 2697 # As we are in run phase use docker run. cmd will be completed below 2698 $rmatend = "--rm" if ($pbdebug lt 1); 2711 # pbstep 3 2699 2712 $shcmd = "$cmd1 run $rmatend --cidfile=\"$cidfile\" --user $dkaccount --name $pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}-$cmt"; 2700 2713 } … … 2805 2818 copy("$ENV{'PBDESTDIR'}/project-builder-$pbver2$pbextdir.tar.gz","$tpdir/tmp"); 2806 2819 } else { 2807 copy("$ENV{'PBDESTDIR'}/ProjectBuilder-$pbver1$pbextdir.tar.gz","$context"); 2808 copy("$ENV{'PBDESTDIR'}/project-builder-$pbver2$pbextdir.tar.gz","$context"); 2809 print DOCKER "COPY ProjectBuilder-$pbver1$pbextdir.tar.gz /tmp/\n"; 2810 print DOCKER "COPY project-builder-$pbver2$pbextdir.tar.gz /tmp/\n"; 2820 if ($pbstep <= 3) { 2821 copy("$ENV{'PBDESTDIR'}/ProjectBuilder-$pbver1$pbextdir.tar.gz","$context"); 2822 copy("$ENV{'PBDESTDIR'}/project-builder-$pbver2$pbextdir.tar.gz","$context"); 2823 print DOCKER "COPY ProjectBuilder-$pbver1$pbextdir.tar.gz /tmp/\n"; 2824 print DOCKER "COPY project-builder-$pbver2$pbextdir.tar.gz /tmp/\n"; 2825 } 2811 2826 } 2812 2827 } else { … … 3158 3173 my $pbforce=shift; # Force stop of VM. Default not. 3159 3174 my $snapme = shift; # By default do not snap a VM/VE/RM 3160 my $usesnap = shift; 3175 my $usesnap = shift; # By default study the usage of the snapshot feature of VM/VE/RM 3161 3176 my $pbimage=shift; # Which image to use to start the VM/VE 3162 3177 my $vexist = undef; … … 4386 4401 # pb -p pb -m distro-ver-arch newve -i distro:ver 4387 4402 ($pbforce == 1) ? $lmsg = "Forced" : $lmsg = "not found"; 4388 pb_log(0,"Docker container$lctn $lmsg, creating it\n");4403 pb_log(0,"Docker image $lctn $lmsg, creating it\n"); 4389 4404 pb_launchv(undef,"ve",$v,$action,0,$pbforce,undef,undef,$pbimage); 4390 4405 } 4406 # Remove ref to pbimage so the rest uses the previous one built 4407 $pbimage = undef; 4391 4408 $lctn = "$docrepo$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}-pb"; 4392 4409 $found = pb_ve_docker_get_image($lctn); 4393 4410 if (($pbforce == 1) || (not defined $found)) { 4394 4411 ($pbforce == 1) ? $lmsg = "Forced" : $lmsg = "not found"; 4395 pb_log(0,"Docker container$lctn $lmsg, creating it\n");4412 pb_log(0,"Docker image $lctn $lmsg, creating it\n"); 4396 4413 # pb -p pb -m distro-ver-arch setupve 4397 4414 if ($savproj eq "pb") { … … 4410 4427 if (($pbforce == 1) || (not defined $found)) { 4411 4428 ($pbforce == 1) ? $lmsg = "Forced" : $lmsg = "not found"; 4412 pb_log(0,"Docker container$lctn $lmsg, creating it\n");4429 pb_log(0,"Docker image $lctn $lmsg, creating it\n"); 4413 4430 # pb -p pb -m distro-ver-arch prepve 4414 4431 if ($savproj eq "pb") {
Note:
See TracChangeset
for help on using the changeset viewer.