commit 72cef35abc02a397c63a3309042142d493c171f9
Author: Elan Ruusamäe <g...@delfi.ee>
Date:   Fri Sep 23 01:22:55 2016 +0300

    detach docker images from binary
    
    https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/1504

 gitlab-ci-multi-runner.spec | 31 ++++++++++++++++++++++++-------
 nodim_gz.patch              | 27 +++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 7 deletions(-)
---
diff --git a/gitlab-ci-multi-runner.spec b/gitlab-ci-multi-runner.spec
index f636af2..38a4ee9 100644
--- a/gitlab-ci-multi-runner.spec
+++ b/gitlab-ci-multi-runner.spec
@@ -1,3 +1,7 @@
+#
+# Conditional build:
+%bcond_with    bindata         # embed docker images to binary (upstream 
compatible)
+
 # the revision for images
 # $ git fetch https://gitlab.com/gitlab-org/gitlab-ci-multi-runner 
refs/tags/v1.6.0
 # $ git rev-list -n 1 --abbrev-commit FETCH_HEAD
@@ -16,9 +20,10 @@ Source1:     
https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/master/docker
 # Source1-md5: 0d89c7578a0b5d22a4ae85dcb7d5b4f5
 Source2:       
https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/master/docker/prebuilt-arm.tar.xz
 # Source2-md5: c0533c581624dcb33095f08f06e6a00b
+Patch0:                nodim_gz.patch
 URL:           https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
 BuildRequires: git-core
-BuildRequires: go-bindata >= 3.0.7-1.a0ff2567
+%{?with_bindata:BuildRequires: go-bindata >= 3.0.7-1.a0ff2567}
 BuildRequires: golang >= 1.4
 BuildRequires: rpmbuild(macros) >= 1.202
 Requires(postun):      /usr/sbin/groupdel
@@ -59,11 +64,15 @@ install -d src/$(dirname %{import_path})
 mv gitlab-ci-multi-runner-* src/%{import_path}
 cd src/%{import_path}
 
-mkdir -p out/docker
+%{!?with_bindata:%patch0 -p1}
+
+%if %{with bindata}
+install -d out/docker
 ln -s %{SOURCE1} out/docker
 ln -s %{SOURCE2} out/docker
 # touch, otherwise make rules would download it nevertheless
 touch out/docker/prebuilt-*.tar.xz
+%endif
 
 # avoid docker being used even if executable found
 cat <<'EOF' > docker
@@ -74,18 +83,16 @@ EOF
 chmod a+rx docker
 
 %build
-# check that the revision is correct
-#tar xvf out/docker/prebuilt.tar.gz repositories
-#revision=$(sed -rne 's/.*"gitlab-runner-build":\{"([^"]+)":.*/\1/p' 
repositories)
-#test "$revision" = %{revision}
-
 export GOPATH=$(pwd)
 cd src/%{import_path}
 export PATH=$(pwd):$PATH
 
+%if %{with bindata}
 # build docker bindata. if you forget this, you get such error:
 # executors/docker/executor_docker.go:180: undefined: Asset
 %{__make} docker
+%endif
+
 %{__make} version | tee version.txt
 
 CN=gitlab.com/gitlab-org/gitlab-ci-multi-runner/common
@@ -106,6 +113,11 @@ install -p src/%{import_path}/%{name} 
$RPM_BUILD_ROOT%{_bindir}/gitlab-runner
 # backward compat name for previous pld packaging
 ln -s gitlab-runner $RPM_BUILD_ROOT%{_bindir}/gitlab-ci-multi-runner
 
+%if %{without bindata}
+cp -p %{SOURCE1} $RPM_BUILD_ROOT/var/lib/gitlab-runner
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/var/lib/gitlab-runner
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -127,3 +139,8 @@ fi
 %attr(755,root,root) %{_bindir}/gitlab-runner
 %dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner
 %dir %attr(750,gitlab-runner,gitlab-runner) 
/var/lib/gitlab-runner/.gitlab-runner
+
+%if %{without bindata}
+/var/lib/gitlab-runner/prebuilt-arm.tar.xz
+/var/lib/gitlab-runner/prebuilt-x86_64.tar.xz
+%endif
diff --git a/nodim_gz.patch b/nodim_gz.patch
new file mode 100644
index 0000000..78edd99
--- /dev/null
+++ b/nodim_gz.patch
@@ -0,0 +1,27 @@
+Last-Update: 2016-08-24
+Forwarded: not-needed
+Bug-Upstream: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/1504
+Author: Dmitry Smirnov <only...@debian.org>
+Description: do not incorporate Docker image into executable.
+
+--- gitlab-ci-multi-runner/executors/docker/executor_docker.go~        
2016-09-22 20:36:49.000000000 +0300
++++ gitlab-ci-multi-runner/executors/docker/executor_docker.go 2016-09-22 
22:46:50.385436324 +0300
+@@ -181,17 +181,11 @@
+               return
+       }
+ 
+-      data, err := Asset("prebuilt-" + architecture + prebuiltImageExtension)
+-      if err != nil {
+-              return nil, fmt.Errorf("Unsupported architecture: %s: %q", 
architecture, err.Error())
+-      }
+-
+       s.Debugln("Loading prebuilt image...")
+       err = s.client.ImportImage(docker.ImportImageOptions{
+               Repository:  prebuiltImageName + "-" + architecture,
+               Tag:         common.REVISION,
+-              Source:      "-",
+-              InputStream: bytes.NewBuffer(data),
++              Source:      "/var/lib/gitlab-runner/prebuilt-" + architecture 
+ ".tar.xz",
+       })
+       if err != nil {
+               return
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/gitlab-ci-multi-runner.git/commitdiff/72cef35abc02a397c63a3309042142d493c171f9

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to