Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
d578198a
Commit
d578198a
authored
Mar 10, 2020
by
Erik Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add rpm build & repo publish
parent
456962b2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
216 additions
and
7 deletions
+216
-7
.dockerignore
.dockerignore
+0
-5
.drone.yml
.drone.yml
+36
-1
k3s.spec
package/k3s.spec
+57
-0
package-rpm
scripts/package-rpm
+78
-0
gen-gpg-keys
scripts/provision/generic/centos7/gen-gpg-keys
+37
-0
yum-install-rpm-tools
scripts/provision/generic/centos7/yum-install-rpm-tools
+7
-0
version.sh
scripts/version.sh
+1
-1
No files found.
.dockerignore
View file @
d578198a
./bin
./etc
./build/data
./build/data.tar.gz
./pkg/data/zz_generated_bindata.go
./package/data.tar.gz
./.vagrant
./.cache
./.dapper
./data-dir
./dist
./.trash-cache
.drone.yml
View file @
d578198a
...
...
@@ -59,6 +59,23 @@ steps:
event
:
-
tag
-
name
:
rpm-publish
image
:
centos:7
environment
:
PRIVATE_KEY
:
from_secret
:
private_key
PRIVATE_KEY_PASS_PHRASE
:
from_secret
:
private_key_pass_phrase
AWS_S3_BUCKET
:
from_secret
:
aws_s3_bucket
AWS_ACCESS_KEY_ID
:
from_secret
:
aws_access_key_id
AWS_SECRET_ACCESS_KEY
:
from_secret
:
aws_secret_access_key
commands
:
-
scripts/provision/generic/centos7/yum-install-rpm-tools
-
scripts/package-rpm
-
name
:
test
image
:
rancher/dapper:v0.4.2
secrets
:
[
gcloud_auth
]
...
...
@@ -154,6 +171,23 @@ steps:
event
:
-
tag
-
name
:
rpm-publish
image
:
centos:7
environment
:
PRIVATE_KEY
:
from_secret
:
private_key
PRIVATE_KEY_PASS_PHRASE
:
from_secret
:
private_key_pass_phrase
AWS_S3_BUCKET
:
from_secret
:
aws_s3_bucket
AWS_ACCESS_KEY_ID
:
from_secret
:
aws_access_key_id
AWS_SECRET_ACCESS_KEY
:
from_secret
:
aws_secret_access_key
commands
:
-
scripts/provision/generic/centos7/yum-install-rpm-tools
-
scripts/package-rpm
-
name
:
test
image
:
rancher/dapper:v0.4.2
secrets
:
[
gcloud_auth
]
...
...
@@ -323,6 +357,6 @@ volumes:
-
name
:
docker
host
:
path
:
/var/run/docker.sock
depends_on
:
-
manifest
\ No newline at end of file
package/k3s.spec
0 → 100644
View file @
d578198a
# vim: sw=4:ts=4:et
%define install_path /usr/bin
%define util_path %{_datadir}/k3s
%define install_sh %{util_path}/.install.sh
%define uninstall_sh %{util_path}/.uninstall.sh
Name: k3s
Version: %{k3s_version}
Release: %{k3s_release}%{?dist}
Summary: Lightweight Kubernetes
Group: System Environment/Base
License: ASL 2.0
URL: http://k3s.io
BuildRequires: systemd
Requires(post): k3s-selinux >= %{k3s_policyver}
%description
The certified Kubernetes distribution built for IoT & Edge computing.
%install
install -d %{buildroot}%{install_path}
install dist/artifacts/%{k3s_binary} %{buildroot}%{install_path}/k3s
install -d %{buildroot}%{util_path}
install install.sh %{buildroot}%{install_sh}
%post
# do not run install script on upgrade
echo post-install args: $@
if [ $1 == 1 ]; then
INSTALL_K3S_BIN_DIR=%{install_path} \
INSTALL_K3S_SKIP_DOWNLOAD=true \
INSTALL_K3S_SKIP_ENABLE=true \
UNINSTALL_K3S_SH=%{uninstall_sh} \
%{install_sh}
fi
%systemd_post k3s.service
exit 0
%postun
echo post-uninstall args: $@
# do not run uninstall script on upgrade
if [ $1 == 0 ]; then
%{uninstall_sh}
rm -rf %{util_path}
fi
exit 0
%files
%{install_path}/k3s
%{install_sh}
%changelog
* Mon Mar 2 2020 Erik Wilson <erik@rancher.com> 0.1-1
- Initial version
scripts/package-rpm
0 → 100755
View file @
d578198a
#!/bin/bash
set
-e
-x
cd
$(
dirname
$0
)
/..
ARCH
=
${
DRONE_STAGE_ARCH
:-$(
arch
)}
.
./scripts/version.sh
if
[[
!
"
$VERSION
"
=
~ ^v[0-9]+
\.
[
0-9]+
\.
[
0-9]+
(
\-
[
^
\+
]
*
)
?
\+
k3s.+
$
]]
;
then
echo
"k3s version
$VERSION
does not match regex for rpm upload"
exit
0
fi
TMPDIR
=
$(
mktemp
-d
)
cleanup
()
{
exit_code
=
$?
trap
- EXIT INT
rm
-rf
${
TMPDIR
}
exit
${
exit_code
}
}
trap
cleanup EXIT INT
export
HOME
=
${
TMPDIR
}
BIN_SUFFIX
=
""
if
[
${
ARCH
}
=
aarch64
]
||
[
${
ARCH
}
=
arm64
]
;
then
BIN_SUFFIX
=
"-arm64"
elif
[
${
ARCH
}
=
armv7l
]
||
[
${
ARCH
}
=
arm
]
;
then
BIN_SUFFIX
=
"-armhf"
fi
# capture version of k3s
k3s_version
=
$(
sed
-E
-e
's/^v([^-+]*).*$/\1/'
<<<
$VERSION
)
# capture pre-release and metadata information of k3s
k3s_release
=
$(
sed
-E
-e
's/\+k3s/+/; s/\+/-/g; s/^[^-]*//; s/^--/dev-/; s/-+/./g; s/^\.+//; s/\.+$//;'
<<<
$VERSION
)
# k3s-selinux policy version needed for functionality
k3s_policyver
=
0.1-1
rpmbuild
\
--define
"k3s_version
${
k3s_version
}
"
\
--define
"k3s_release
${
k3s_release
}
"
\
--define
"k3s_policyver
${
k3s_policyver
}
"
\
--define
"k3s_binary k3s
${
BIN_SUFFIX
}
"
\
--define
"_sourcedir
${
PWD
}
"
\
--define
"_specdir
${
PWD
}
"
\
--define
"_builddir
${
PWD
}
"
\
--define
"_srcrpmdir
${
PWD
}
"
\
--define
"_rpmdir
${
PWD
}
/dist/rpm"
\
--define
"_buildrootdir
${
PWD
}
/.rpm-build"
\
-bb
package/k3s.spec
if
!
grep
"BEGIN PGP PRIVATE KEY BLOCK"
<<<
"
$PRIVATE_KEY
"
;
then
echo
"PRIVATE_KEY not defined, skipping rpm sign and upload"
exit
0
fi
cat
<<
\
EOF
>~/.rpmmacros
%_signature gpg
%_gpg_name ci@rancher.com
EOF
gpg
--import
-
<<<
"
$PRIVATE_KEY
"
expect
<<
EOF
set timeout 60
spawn sh -c "rpmsign --addsign dist/rpm/**/k3s-*.rpm"
expect "Enter pass phrase:"
send -- "
$PRIVATE_KEY_PASS_PHRASE
\r"
expect eof
lassign [wait] _ _ _ code
exit \
$code
EOF
if
[
-z
"
$AWS_S3_BUCKET
"
]
;
then
echo
"AWS_S3_BUCKET skipping rpm upload"
exit
0
fi
rpm-s3
--bucket
$AWS_S3_BUCKET
dist/rpm/
**
/k3s-
*
.rpm
scripts/provision/generic/centos7/gen-gpg-keys
0 → 100755
View file @
d578198a
#!/bin/bash
set
-e
-x
TMPDIR
=
$(
mktemp
-d
)
cleanup
()
{
exit_code
=
$?
trap
- EXIT INT
rm
-rf
${
TMPDIR
}
exit
${
exit_code
}
}
trap
cleanup EXIT INT
export
HOME
=
${
TMPDIR
}
gpg
--batch
--gen-key
-
<<
EOF
%echo Generating a default key
Key-Type: default
Subkey-Type: default
Name-Real: Rancher
Name-Comment: CI
Name-Email: ci@rancher.com
Expire-Date: 0
# Key-Length: 4096
# Subkey-Length: 4096
Passphrase:
$PRIVATE_KEY_PASS_PHRASE
# %no-protection
# %no-ask-passphrase
# Do a commit here, so that we can later print "done" :-)
%commit
%echo done
EOF
gpg
--armor
--export
ci@rancher.com
>
public.key
gpg
--armor
--export-secret-key
ci@rancher.com
>
private.key
scripts/provision/generic/centos7/yum-install-rpm-tools
0 → 100755
View file @
d578198a
#!/bin/bash
set
-e
-x
yum
install
-y
git expect yum-utils rpm-build rpm-sign python-deltarpm epel-release
yum
install
-y
python2-pip
pip
install
git+git://github.com/Voronenko/rpm-s3.git@5695c6ad9a08548141d3713328e1bd3f533d137e
scripts/version.sh
View file @
d578198a
...
...
@@ -4,7 +4,7 @@ ARCH=${ARCH:-$(go env GOARCH)}
SUFFIX
=
"-
${
ARCH
}
"
GIT_TAG
=
$DRONE_TAG
TREE_STATE
=
clean
COMMIT
=
unknown
COMMIT
=
$DRONE_COMMIT
if
[
-d
.git
]
;
then
if
[
-z
"
$GIT_TAG
"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment