Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab-runner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Seipel
gitlab-runner
Commits
3d49c9f2
Unverified
Commit
3d49c9f2
authored
6 years ago
by
Tomasz Maczukin
Browse files
Options
Downloads
Patches
Plain Diff
Refactor packaging and building parts of Makefile
parent
026382bc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+4
-123
4 additions, 123 deletions
Makefile
Makefile.build.mk
+26
-0
26 additions, 0 deletions
Makefile.build.mk
Makefile.package.mk
+29
-0
29 additions, 0 deletions
Makefile.package.mk
ci/package
+96
-0
96 additions, 0 deletions
ci/package
with
155 additions
and
123 deletions
Makefile
+
4
−
123
View file @
3d49c9f2
NAME
?=
gitlab-runner
NAME
?=
gitlab-runner
PACKAGE_NAME
?=
$(
NAME
)
export
PACKAGE_NAME
?=
$(
NAME
)
export
VERSION
:=
$(
shell ./ci/version
)
export
VERSION
:=
$(
shell ./ci/version
)
REVISION
:=
$(
shell git rev-parse
--short
=
8 HEAD
||
echo
unknown
)
REVISION
:=
$(
shell git rev-parse
--short
=
8 HEAD
||
echo
unknown
)
BRANCH
:=
$(
shell git show-ref |
grep
"
$(
REVISION
)
"
|
grep
-v
HEAD |
awk
'{print $$2
}
'
|
sed
's|refs/remotes/origin/||'
|
sed
's|refs/heads/||'
|
sort
|
head
-n
1
)
BRANCH
:=
$(
shell git show-ref |
grep
"
$(
REVISION
)
"
|
grep
-v
HEAD |
awk
'{print $$2
}
'
|
sed
's|refs/remotes/origin/||'
|
sed
's|refs/heads/||'
|
sort
|
head
-n
1
)
...
@@ -67,6 +67,8 @@ MOCKERY_FLAGS = -note="This comment works around https://github.com/vektra/mocke
...
@@ -67,6 +67,8 @@ MOCKERY_FLAGS = -note="This comment works around https://github.com/vektra/mocke
all
:
deps docker build
all
:
deps docker build
include
Makefile.docker.mk
include
Makefile.docker.mk
include
Makefile.build.mk
include
Makefile.package.mk
help
:
help
:
# Commands:
# Commands:
...
@@ -102,34 +104,6 @@ deps: $(DEVELOPMENT_TOOLS)
...
@@ -102,34 +104,6 @@ deps: $(DEVELOPMENT_TOOLS)
codequality
:
codequality
:
./scripts/codequality analyze
--dev
./scripts/codequality analyze
--dev
build
:
$(GOX)
# Building
$(
NAME
)
in
version
$(
VERSION
)
for
$(
BUILD_PLATFORMS
)
gox
$(
BUILD_PLATFORMS
)
\
-ldflags
"
$(
GO_LDFLAGS
)
"
\
-output
=
"out/binaries/
$(
NAME
)
-{{.OS}}-{{.Arch}}"
\
$(
PKG
)
build_simple
:
$(GOPATH_SETUP)
# Building
$(
NAME
)
in
version
$(
VERSION
)
for
current platform
go build
\
-ldflags
"
$(
GO_LDFLAGS
)
"
\
-o
"out/binaries/
$(
NAME
)
"
\
$(
PKG
)
build_current
:
docker build_simple
build_current_docker
:
RUNNER_BINARY ?= out/binaries/$(NAME)
build_current_docker
:
build_current_deb
make release_docker_images
RUNNER_BINARY
=
$(
RUNNER_BINARY
)
build_current_deb
:
RUNNER_BINARY ?= out/binaries/$(NAME)
build_current_deb
:
build_current package-deps package-prepare
make package-deb-fpm
ARCH
=
amd64
PACKAGE_ARCH
=
amd64
RUNNER_BINARY
=
$(
RUNNER_BINARY
)
build_current_rpm
:
RUNNER_BINARY ?= out/binaries/$(NAME)
build_current_rpm
:
build_current package-deps package-prepare
make package-rpm-fpm
ARCH
=
amd64
PACKAGE_ARCH
=
amd64
RUNNER_BINARY
=
$(
RUNNER_BINARY
)
check_race_conditions
:
check_race_conditions
:
@
./scripts/check_race_conditions
$(
OUR_PACKAGES
)
@
./scripts/check_race_conditions
$(
OUR_PACKAGES
)
...
@@ -194,99 +168,6 @@ build-and-deploy-binary:
...
@@ -194,99 +168,6 @@ build-and-deploy-binary:
make build
BUILD_PLATFORMS
=
"-os=linux -arch=amd64"
make build
BUILD_PLATFORMS
=
"-os=linux -arch=amd64"
scp out/binaries/
$(
PACKAGE_NAME
)
-linux-amd64
$(
SERVER
)
:/usr/bin/gitlab-runner
scp out/binaries/
$(
PACKAGE_NAME
)
-linux-amd64
$(
SERVER
)
:/usr/bin/gitlab-runner
package
:
package-deps package-prepare package-deb package-rpm
package-deps
:
# Installing packaging dependencies...
which fpm 1>/dev/null
||
gem
install
rake fpm
--no-ri
--no-rdoc
package-prepare
:
chmod
755 packaging/root/usr/share/gitlab-runner/
chmod
755 packaging/root/usr/share/gitlab-runner/
*
package-deb
:
package-deps package-prepare
# Building Debian compatible packages...
make package-deb-fpm
ARCH
=
amd64
PACKAGE_ARCH
=
amd64
make package-deb-fpm
ARCH
=
386
PACKAGE_ARCH
=
i386
make package-deb-fpm
ARCH
=
arm
PACKAGE_ARCH
=
armel
make package-deb-fpm
ARCH
=
arm
PACKAGE_ARCH
=
armhf
package-rpm
:
package-deps package-prepare
# Building RedHat compatible packages...
make package-rpm-fpm
ARCH
=
amd64
PACKAGE_ARCH
=
amd64
make package-rpm-fpm
ARCH
=
386
PACKAGE_ARCH
=
i686
make package-rpm-fpm
ARCH
=
arm
PACKAGE_ARCH
=
arm
make package-rpm-fpm
ARCH
=
arm
PACKAGE_ARCH
=
armhf
package-deb-fpm
:
RUNNER_BINARY ?= out/binaries/$(NAME)-linux-$(ARCH)
package-deb-fpm
:
@
mkdir
-p
out/deb/
fpm
-s
dir
-t
deb
-n
$(
PACKAGE_NAME
)
-v
$(
VERSION
)
\
-p
out/deb/
$(
PACKAGE_NAME
)
_
$(
PACKAGE_ARCH
)
.deb
\
--deb-priority
optional
--category
admin
\
--force
\
--deb-compression
bzip2
\
--after-install
packaging/scripts/postinst.deb
\
--before-remove
packaging/scripts/prerm.deb
\
--url
https://gitlab.com/gitlab-org/gitlab-runner
\
--description
"GitLab Runner"
\
-m
"GitLab Inc. <support@gitlab.com>"
\
--license
"MIT"
\
--vendor
"GitLab Inc."
\
--conflicts
$(
PACKAGE_NAME
)
-beta
\
--conflicts
gitlab-ci-multi-runner
\
--conflicts
gitlab-ci-multi-runner-beta
\
--provides
gitlab-ci-multi-runner
\
--replaces
gitlab-ci-multi-runner
\
--depends
ca-certificates
\
--depends
git
\
--depends
curl
\
--depends
tar
\
--deb-suggests
docker-engine
\
-a
$(
PACKAGE_ARCH
)
\
packaging/root/
=
/
\
$(
RUNNER_BINARY
)
=
/usr/lib/gitlab-runner/gitlab-runner
\
out/helper-images/
=
/usr/lib/gitlab-runner/helper-images/
@
if
[
-n
"
$(
GPG_KEYID
)
"
]
;
then
\
dpkg-sig
-g
"--no-tty --digest-algo 'sha512' --passphrase '
$(
GPG_PASSPHRASE
)
'"
\
-k
$(
GPG_KEYID
)
--sign
builder
"out/deb/
$(
PACKAGE_NAME
)
_
$(
PACKAGE_ARCH
)
.deb"
;
\
fi
package-rpm-fpm
:
RUNNER_BINARY ?= out/binaries/$(NAME)-linux-$(ARCH)
package-rpm-fpm
:
@
mkdir
-p
out/rpm/
fpm
-s
dir
-t
rpm
-n
$(
PACKAGE_NAME
)
-v
$(
VERSION
)
\
-p
out/rpm/
$(
PACKAGE_NAME
)
_
$(
PACKAGE_ARCH
)
.rpm
\
--rpm-compression
bzip2
--rpm-os
linux
\
--force
\
--after-install
packaging/scripts/postinst.rpm
\
--before-remove
packaging/scripts/prerm.rpm
\
--url
https://gitlab.com/gitlab-org/gitlab-runner
\
--description
"GitLab Runner"
\
-m
"GitLab Inc. <support@gitlab.com>"
\
--license
"MIT"
\
--vendor
"GitLab Inc."
\
--conflicts
$(
PACKAGE_NAME
)
-beta
\
--conflicts
gitlab-ci-multi-runner
\
--conflicts
gitlab-ci-multi-runner-beta
\
--provides
gitlab-ci-multi-runner
\
--replaces
gitlab-ci-multi-runner
\
--depends
git
\
--depends
curl
\
--depends
tar
\
-a
$(
PACKAGE_ARCH
)
\
packaging/root/
=
/
\
$(
RUNNER_BINARY
)
=
/usr/lib/gitlab-runner/gitlab-runner
\
out/helper-images/
=
/usr/lib/gitlab-runner/helper-images/
@
if
[
-n
"
$(
GPG_KEYID
)
"
]
;
then
\
echo
"yes"
| setsid rpm
\
--define
"_gpg_name
$(
GPG_KEYID
)
"
\
--define
"_signature gpg"
\
--define
"__gpg_check_password_cmd /bin/true"
\
--define
"__gpg_sign_cmd %{__gpg} gpg --batch --no-armor --digest-algo 'sha512' --passphrase '
$(
GPG_PASSPHRASE
)
' --no-secmem-warning -u '%{_gpg_name}' --sign --detach-sign --output %{__signature_filename} %{__plaintext_filename}"
\
--addsign
out/rpm/
$(
PACKAGE_NAME
)
_
$(
PACKAGE_ARCH
)
.rpm
;
\
fi
packagecloud
:
packagecloud-deps packagecloud-deb packagecloud-rpm
packagecloud
:
packagecloud-deps packagecloud-deb packagecloud-rpm
packagecloud-deps
:
packagecloud-deps
:
...
@@ -356,7 +237,7 @@ prepare_index:
...
@@ -356,7 +237,7 @@ prepare_index:
# Preparing index file
# Preparing index file
@
./ci/prepare_index
@
./ci/prepare_index
release_docker_images
:
RUNNER_BINARY
?
= out/binaries/gitlab-runner-linux-amd64
release_docker_images
:
export
RUNNER_BINARY
:
= out/binaries/gitlab-runner-linux-amd64
release_docker_images
:
release_docker_images
:
# Releasing Docker images
# Releasing Docker images
@
./ci/release_docker_images
@
./ci/release_docker_images
...
...
This diff is collapsed.
Click to expand it.
Makefile.build.mk
0 → 100644
+
26
−
0
View file @
3d49c9f2
export
RUNNER_BINARY
?=
out/binaries/
$(
NAME
)
build
:
$(GOX)
# Building
$(
NAME
)
in
version
$(
VERSION
)
for
$(
BUILD_PLATFORMS
)
gox
$(
BUILD_PLATFORMS
)
\
-ldflags
"
$(
GO_LDFLAGS
)
"
\
-output
=
"out/binaries/
$(
NAME
)
-{{.OS}}-{{.Arch}}"
\
$(
PKG
)
build_simple
:
$(GOPATH_SETUP)
# Building
$(
NAME
)
in
version
$(
VERSION
)
for
current platform
go build
\
-ldflags
"
$(
GO_LDFLAGS
)
"
\
-o
"
$(
RUNNER_BINARY
)
"
\
$(
PKG
)
build_current
:
docker build_simple
build_current_docker
:
build_current_deb
make release_docker_images
RUNNER_BINARY
=
$(
RUNNER_BINARY
)
build_current_deb
:
build_current package-deps package-prepare
make package-deb-fpm
ARCH
=
amd64
PACKAGE_ARCH
=
amd64
RUNNER_BINARY
=
$(
RUNNER_BINARY
)
build_current_rpm
:
build_current package-deps package-prepare
make package-rpm-fpm
ARCH
=
amd64
PACKAGE_ARCH
=
amd64
RUNNER_BINARY
=
$(
RUNNER_BINARY
)
This diff is collapsed.
Click to expand it.
Makefile.package.mk
0 → 100644
+
29
−
0
View file @
3d49c9f2
package
:
package-deps package-prepare package-deb package-rpm
package-deps
:
# Installing packaging dependencies...
which fpm 1>/dev/null
||
gem
install
rake fpm
--no-ri
--no-rdoc
package-prepare
:
chmod
755 packaging/root/usr/share/gitlab-runner/
chmod
755 packaging/root/usr/share/gitlab-runner/
*
package-deb
:
package-deps package-prepare
# Building Debian compatible packages...
make package-deb-fpm
ARCH
=
amd64
PACKAGE_ARCH
=
amd64
RUNNER_BINARY
=
out/binaries/
$(
NAME
)
-linux-amd64
make package-deb-fpm
ARCH
=
386
PACKAGE_ARCH
=
i386
RUNNER_BINARY
=
out/binaries/
$(
NAME
)
-linux-386
make package-deb-fpm
ARCH
=
arm
PACKAGE_ARCH
=
armel
RUNNER_BINARY
=
out/binaries/
$(
NAME
)
-linux-arm
make package-deb-fpm
ARCH
=
arm
PACKAGE_ARCH
=
armhf
RUNNER_BINARY
=
out/binaries/
$(
NAME
)
-linux-arm
package-rpm
:
package-deps package-prepare
# Building RedHat compatible packages...
make package-rpm-fpm
ARCH
=
amd64
PACKAGE_ARCH
=
amd64
RUNNER_BINARY
=
out/binaries/
$(
NAME
)
-linux-amd64
make package-rpm-fpm
ARCH
=
386
PACKAGE_ARCH
=
i686
RUNNER_BINARY
=
out/binaries/
$(
NAME
)
-linux-386
make package-rpm-fpm
ARCH
=
arm
PACKAGE_ARCH
=
arm
RUNNER_BINARY
=
out/binaries/
$(
NAME
)
-linux-arm
make package-rpm-fpm
ARCH
=
arm
PACKAGE_ARCH
=
armhf
RUNNER_BINARY
=
out/binaries/
$(
NAME
)
-linux-arm
package-deb-fpm
:
@
./ci/package deb
package-rpm-fpm
:
@
./ci/package rpm
This diff is collapsed.
Click to expand it.
ci/package
0 → 100755
+
96
−
0
View file @
3d49c9f2
#!/usr/bin/env bash
set
-eo
pipefail
create_package
()
{
local
packageType
=
${
1
}
shift
local
customOptions
read
-r
-a
customOptions
<<<
"
${
@
}
"
mkdir
-p
"out/
${
packageType
}
/"
fpm
\
--package
"out/
${
packageType
}
/
${
PACKAGE_NAME
}
_
${
PACKAGE_ARCH
}
.
${
packageType
}
"
\
--force
\
--input-type
dir
\
--output-type
"
${
packageType
}
"
\
\
--name
"
${
PACKAGE_NAME
}
"
\
--description
"GitLab Runner"
\
--version
"
${
VERSION
}
"
\
--url
https://gitlab.com/gitlab-org/gitlab-runner
\
--maintainer
"GitLab Inc. <support@gitlab.com>"
\
--license
"MIT"
\
--vendor
"GitLab Inc."
\
--architecture
"
${
PACKAGE_ARCH
}
"
\
\
--conflicts
"
${
PACKAGE_NAME
}
-beta"
\
--conflicts
gitlab-ci-multi-runner
\
--conflicts
gitlab-ci-multi-runner-beta
\
--provides
gitlab-ci-multi-runner
\
--replaces
gitlab-ci-multi-runner
\
\
--depends
git
\
--depends
curl
\
--depends
tar
\
\
${
customOptions
[@]
}
\
\
--after-install
"packaging/scripts/postinst.
${
packageType
}
"
\
--before-remove
"packaging/scripts/prerm.
${
packageType
}
"
\
\
packaging/root/
=
/
\
"
${
RUNNER_BINARY
}
=/usr/lib/gitlab-runner/gitlab-runner"
\
out/helper-images/
=
/usr/lib/gitlab-runner/helper-images/
}
create_deb
()
{
local
options
=()
options+
=(
"--depends ca-certificates"
)
options+
=(
"--category admin"
)
options+
=(
"--deb-priority optional"
)
options+
=(
"--deb-compression bzip2"
)
options+
=(
"--deb-suggests docker-engine"
)
create_package deb
"
${
options
[@]
}
"
if
[
-n
"
${
GPG_KEYID
}
"
]
;
then
dpkg-sig
\
-g
"--no-tty --digest-algo 'sha512' --passphrase '
${
GPG_PASSPHRASE
}
'"
\
-k
"
${
GPG_KEYID
}
"
\
--sign
builder
"out/deb/
${
PACKAGE_NAME
}
_
${
PACKAGE_ARCH
}
.deb"
fi
}
create_rpm
()
{
local
options
=()
options+
=(
"--rpm-compression bzip2"
)
options+
=(
"--rpm-os linux"
)
create_package rpm
"
${
options
[@]
}
"
if
[
-n
"
${
GPG_KEYID
}
"
]
;
then
echo
"yes"
| setsid rpm
\
--define
"_gpg_name
${
GPG_KEYID
}
"
\
--define
"_signature gpg"
\
--define
"__gpg_check_password_cmd /bin/true"
\
--define
"__gpg_sign_cmd %{__gpg} gpg --batch --no-armor --digest-algo 'sha512' --passphrase '
${
GPG_PASSPHRASE
}
' --no-secmem-warning -u '%{_gpg_name}' --sign --detach-sign --output %{__signature_filename} %{__plaintext_filename}"
\
--addsign
"out/rpm/
${
PACKAGE_NAME
}
_
${
PACKAGE_ARCH
}
.rpm"
fi
}
case
"
${
1
}
"
in
deb
)
create_deb
;;
rpm
)
create_rpm
;;
*
)
echo
"Usage:
${
0
}
(deb|rpm)"
;;
esac
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment