Skip to content

Commit

Permalink
Initial centos8 creation
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Kim <[email protected]>
  • Loading branch information
Oats87 committed Aug 26, 2020
1 parent 6d2390a commit cf62210
Show file tree
Hide file tree
Showing 15 changed files with 641 additions and 5 deletions.
185 changes: 182 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ steps:
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-amd64.txt
checksum_file: CHECKSUMsum-centos7-amd64.txt
checksum_flatten: true
files:
- "dist/centos7/x86_64/*"
Expand Down Expand Up @@ -161,7 +161,7 @@ steps:
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-srcrpm.txt
checksum_file: CHECKSUMsum-centos7-srcrpm.txt
checksum_flatten: true
files:
- "dist/centos7/source/*.src.rpm"
Expand All @@ -176,4 +176,183 @@ steps:
volumes:
- name: docker
host:
path: /var/run/docker.sock
path: /var/run/docker.sock
---
kind: pipeline
name: rke2-packaging-centos8-x86_64-amd64
platform:
os: linux
arch: amd64
steps:
- name: build-rpm-centos8-x86_64-amd64
image: rancher/dapper:v0.5.0
environment:
COMBARCH: x86_64-amd64
commands:
- dapper -f Dockerfile.centos8.dapper rpm/centos8/scripts/build
volumes:
- name: docker
path: /var/run/docker.sock

- name: sign-rpm-centos8-x86_64-amd64
image: centos:8
environment:
PRIVATE_KEY:
from_secret: private_key
PRIVATE_KEY_PASS_PHRASE:
from_secret: private_key_pass_phrase
TESTING_PRIVATE_KEY:
from_secret: testing_private_key
TESTING_PRIVATE_KEY_PASS_PHRASE:
from_secret: testing_private_key_pass_phrase
commands:
- rpm/centos8/scripts/sign
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

- name: yum-repo-upload-centos8-x86_64-amd64
image: centos:7
environment:
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
TESTING_AWS_S3_BUCKET:
from_secret: testing_aws_s3_bucket
TESTING_AWS_ACCESS_KEY_ID:
from_secret: testing_aws_access_key_id
TESTING_AWS_SECRET_ACCESS_KEY:
from_secret: testing_aws_secret_access_key
COMBARCH: x86_64-amd64
commands:
- rpm/centos8/scripts/upload-repo
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

- name: github-release-centos8-x86_64-amd64
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-centos8-amd64.txt
checksum_flatten: true
files:
- "dist/centos8/x86_64/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
name: rke2-packaging-centos8-srcrpm
platform:
os: linux
arch: amd64
steps:
- name: build-rpm-centos8-srcrpm
image: rancher/dapper:v0.5.0
environment:
COMBARCH: x86_64-amd64
commands:
- dapper -f Dockerfile.centos8.dapper rpm/centos8/scripts/build
volumes:
- name: docker
path: /var/run/docker.sock

- name: sign-rpm-centos8-srcrpm
image: centos:8
environment:
PRIVATE_KEY:
from_secret: private_key
PRIVATE_KEY_PASS_PHRASE:
from_secret: private_key_pass_phrase
TESTING_PRIVATE_KEY:
from_secret: testing_private_key
TESTING_PRIVATE_KEY_PASS_PHRASE:
from_secret: testing_private_key_pass_phrase
commands:
- rpm/centos8/scripts/sign
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

- name: yum-repo-upload-centos8-srcrpm
image: centos:7
environment:
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
TESTING_AWS_S3_BUCKET:
from_secret: testing_aws_s3_bucket
TESTING_AWS_ACCESS_KEY_ID:
from_secret: testing_aws_access_key_id
TESTING_AWS_SECRET_ACCESS_KEY:
from_secret: testing_aws_secret_access_key
commands:
- rpm/centos8/scripts/upload-srcrpm-repo
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

- name: github-release-centos8-srcrpm
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-centos8-srcrpm.txt
checksum_flatten: true
files:
- "dist/centos8/source/*.src.rpm"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
11 changes: 11 additions & 0 deletions Dockerfile.centos8.dapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM centos:8

RUN yum install -y epel-release && yum -y install yum-utils rpm-build spectool git jq

ENV DAPPER_SOURCE /source
ENV DAPPER_OUTPUT ./dist
ENV DAPPER_ENV COMBARCH DRONE_TAG TAG
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}

ENTRYPOINT ["./rpm/centos8/scripts/entry"]
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ COMBARCH ?= x86_64-amd64
ALL_ARCH = x86_64-amd64 aarch64-arm64

CENTOS7_TARGETS := $(addprefix centos7-,$(shell ls rpm/centos7/scripts))
CENTOS8_TARGETS := $(addprefix centos8-,$(shell ls rpm/centos8/scripts))

.dapper:
@echo Downloading dapper
Expand All @@ -13,9 +14,17 @@ CENTOS7_TARGETS := $(addprefix centos7-,$(shell ls rpm/centos7/scripts))
$(CENTOS7_TARGETS): .dapper
COMBARCH=${COMBARCH} ./.dapper -f Dockerfile.centos7.dapper $(@:centos7-%=%)

$(CENTOS8_TARGETS): .dapper
COMBARCH=${COMBARCH} ./.dapper -f Dockerfile.centos8.dapper $(@:centos8-%=%)

all-centos7-build: $(addprefix sub-centos7-build-,$(ALL_ARCH))

sub-centos7-build-%:
$(MAKE) COMBARCH=$* build
$(MAKE) COMBARCH=$* centos7-build

all-centos8-build: $(addprefix sub-centos8-build-,$(ALL_ARCH))

sub-centos8-build-%:
$(MAKE) COMBARCH=$* centos8-build

.PHONY: $(CENTOS7_TARGETS)
.PHONY: $(CENTOS7_TARGETS) $(CENTOS8_TARGETS)
1 change: 1 addition & 0 deletions rpm/centos8/agent
1 change: 1 addition & 0 deletions rpm/centos8/common
13 changes: 13 additions & 0 deletions rpm/centos8/scripts/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
set -ex

cd "$(dirname $0)"

if [[ -z "$COMBARCH" ]]; then
echo "Combined architecture was not defined, failing build"
exit 1
fi

./build-common
./build-server
./build-agent
37 changes: 37 additions & 0 deletions rpm/centos8/scripts/build-agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -e -x

cd $(dirname $0)/..
. ./scripts/version

if [[ -z "$COMBARCH" ]]; then
echo "Combined architecture was not defined, failing build"
exit 1
fi

IFS=- read RPMARCH GOARCH<<< ${COMBARCH}; unset IFS

mkdir -p "/root/rpmbuild/SPECS"

SRC_PATH="/root/rpmbuild/SOURCES/${RPMARCH}"
mkdir -p ${SRC_PATH}

HOME=/root

cp -r /source/rpm/centos8/agent/* ${SRC_PATH}
cp -r /source/rpm/centos8/agent/rke2-agent.spec /root/rpmbuild/SPECS

cd ${SRC_PATH}

rpmbuild \
--define "rpm_version ${RPM_VERSION}" \
--define "rke2_version ${RKE2_VERSION}" \
--define "rpm_release ${RPM_RELEASE}" \
--define "_sourcedir ${SRC_PATH}" \
--target ${RPMARCH} \
-ba ${SRC_PATH}/rke2-agent.spec

mkdir -p /source/dist/centos8
mkdir -p /source/dist/centos8/source
cp -r /root/rpmbuild/RPMS/* /source/dist/centos8
cp -r /root/rpmbuild/SRPMS/* /source/dist/centos8/source
44 changes: 44 additions & 0 deletions rpm/centos8/scripts/build-common
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
set -e -x

cd $(dirname $0)/..
. ./scripts/version

if [[ -z "$COMBARCH" ]]; then
echo "Combined architecture was not defined, failing build"
exit 1
fi

IFS=- read RPMARCH GOARCH<<< ${COMBARCH}; unset IFS

mkdir -p "/root/rpmbuild/SPECS"

SRC_PATH="/root/rpmbuild/SOURCES/${RPMARCH}"
mkdir -p ${SRC_PATH}

HOME=/root

cp -r /source/rpm/centos8/common/* ${SRC_PATH}
cp -r /source/rpm/centos8/common/rke2-common.spec /root/rpmbuild/SPECS

sed -i "s/\%global ARCH.*/\%global ARCH ${GOARCH}/" ${SRC_PATH}/rke2-common.spec

cd ${SRC_PATH}

spectool -gf rke2-common.spec \
--define "rke2_version ${RKE2_VERSION}" \
--define "ARCH ${GOARCH}"

rpmbuild -vv \
--define "rpm_version ${RPM_VERSION}" \
--define "rke2_version ${RKE2_VERSION}" \
--define "rpm_release ${RPM_RELEASE}" \
--define "rke2_policyver ${RKE2_POLICYVER}" \
--define "_sourcedir ${SRC_PATH}" \
--target ${RPMARCH} \
-ba ${SRC_PATH}/rke2-common.spec

mkdir -p /source/dist/centos8
mkdir -p /source/dist/centos8/source
cp -r /root/rpmbuild/RPMS/* /source/dist/centos8
cp -r /root/rpmbuild/SRPMS/* /source/dist/centos8/source
37 changes: 37 additions & 0 deletions rpm/centos8/scripts/build-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -e -x

cd $(dirname $0)/..
. ./scripts/version

if [[ -z "$COMBARCH" ]]; then
echo "Combined architecture was not defined, failing build"
exit 1
fi

IFS=- read RPMARCH GOARCH<<< ${COMBARCH}; unset IFS

mkdir -p "/root/rpmbuild/SPECS"

SRC_PATH="/root/rpmbuild/SOURCES/${RPMARCH}"
mkdir -p ${SRC_PATH}

HOME=/root

cp -r /source/rpm/centos8/server/* ${SRC_PATH}
cp -r /source/rpm/centos8/server/rke2-server.spec /root/rpmbuild/SPECS

cd ${SRC_PATH}

rpmbuild \
--define "rpm_version ${RPM_VERSION}" \
--define "rke2_version ${RKE2_VERSION}" \
--define "rpm_release ${RPM_RELEASE}" \
--define "_sourcedir ${SRC_PATH}" \
--target ${RPMARCH} \
-ba ${SRC_PATH}/rke2-server.spec

mkdir -p /source/dist/centos8
mkdir -p /source/dist/centos8/source
cp -r /root/rpmbuild/RPMS/* /source/dist/centos8
cp -r /root/rpmbuild/SRPMS/* /source/dist/centos8/source
12 changes: 12 additions & 0 deletions rpm/centos8/scripts/entry
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -ex

if [ -e ./rpm/centos8/scripts/"$1" ]; then
./rpm/centos8/scripts/"$@"
else
exec "$@"
fi

if [ "$DAPPER_UID" -ne "-1" ]; then
chown -R $DAPPER_UID:$DAPPER_GID .
fi
Loading

0 comments on commit cf62210

Please sign in to comment.