Remove unused grok dependencies and improve PPA upload script #257
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2020 Rainer Gerhards and Others | |
# | |
# https://github.com/rsyslog/rsyslog-pkg-ubuntu | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# References: | |
# | |
# https://help.github.com/en/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#github-actions-notification-options | |
# https://github.com/settings/notifications | |
# https://software.opensuse.org//download.html?project=home%3Argerhards&package=rsyslog | |
--- | |
name: CI PR runner | |
on: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
# Default: 360 minutes | |
timeout-minutes: 60 | |
strategy: | |
# When set to true, cancel all in-progress jobs if any matrix job fails. | |
fail-fast: false | |
matrix: | |
release: [22.04] # , 22.04] | |
steps: | |
- name: git checkout packging project | |
uses: actions/checkout@v1 | |
- name: prep cache dir | |
run: mkdir ~/host | |
- name: cache build environment | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/host/osbuild-packagecache | |
#~/host/build-root/**/!(dev|tmp|var)/ | |
key: pkg_cache-${{ matrix.release }}-${{ github.ref }}-${{ github.sha }} | |
restore-keys: | | |
pkg_cache-${{ matrix.release }}-${{ github.ref }}- | |
pkg_cache-${{ matrix.release }}- | |
- name: change permissions for docker osc build | |
run: | | |
sudo chown -R root:root ~/host | |
- name: prep env | |
run: | | |
docker pull rsyslog/rsyslog_obs:basic | |
ls -l ~/host | |
docker run --rm --privileged -e PKG_PROJ -v ~/host:/host -v$(pwd):/work rsyslog/rsyslog_obs:basic \ | |
bash -c " | |
export PKG_PROJ=../../.. | |
mkdir _OBS | |
cd _OBS | |
git clone https://github.com/rsyslog/pkg_obs-clone.git | |
cd pkg_obs-clone/rsyslog | |
echo repair OBS wc | |
osc repairwc . | |
echo packaging ubuntu package defs for OBS | |
source ./build-ubuntu.sh | |
" | |
- name: build Ubuntu ${{ matrix.release }} | |
run: | | |
docker run --rm --privileged -e PKG_PROJ -e RELEASE=${{ matrix.release }} -v ~/host:/host -v$(pwd):/work rsyslog/rsyslog_obs:basic \ | |
bash -c ' | |
export PKG_PROJ=../../.. | |
cd _OBS/pkg_obs-clone/rsyslog | |
osc build --trust-all-projects --local-package xUbuntu_$RELEASE x86_64 | |
' | |
- name: post build permission fixup | |
run: | | |
sudo chown -R $(id -u):$(id -g) ~ | |
- name: prepare repo creation | |
run: | | |
cd $GITHUB_WORKSPACE | |
mkdir debs-${{ matrix.release }} | |
cp ~/host/build-root/xUbuntu_${{ matrix.release }}-x86_64/usr/src/packages/DEBS/* debs-${{ matrix.release }} | |
pwd | |
ls -l | |
- name: save ${{ matrix.release }} DEBs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: debs-${{ matrix.release }} | |
path: debs-${{ matrix.release }} | |
check_22_04: | |
runs-on: ubuntu-22.04 | |
needs: build | |
timeout-minutes: 30 | |
steps: | |
- name: Download 22.04 debs | |
uses: actions/download-artifact@v1 | |
with: | |
name: debs-22.04 | |
- name: merge support libraries from OBS | |
run: | | |
mkdir tt | |
cd tt | |
wget -q http://download.opensuse.org/repositories/home:/rgerhards/xUbuntu_22.04/Packages | |
grep Filename: Packages | grep amd64 | grep -v rsyslog \ | |
| sed 's/Filename: /wget -q http:\/\/download.opensuse.org\/repositories\/home:\/rgerhards\/xUbuntu_22.04\//' \ | |
> tmp | |
source tmp # get .deb files | |
ls -l | |
mv *deb $GITHUB_WORKSPACE/debs-22.04 | |
cd .. | |
rm -rf tt | |
- name: prepare local repository | |
run: | | |
cd debs-22.04 | |
dpkg-scanpackages . /dev/null >Packages | |
cd $GITHUB_WORKSPACE | |
- name: check package install | |
run: | | |
docker run --rm -v $GITHUB_WORKSPACE/debs-22.04:/debs ubuntu:22.04 bash -c \ | |
' | |
echo "deb [trusted=yes] file:///debs ./" >> /etc/apt/sources.list | |
apt-get update | |
apt-get install -y rsyslog rsyslog-improg rsyslog-imkmsg | |
' | |
check_VMs: | |
runs-on: ubuntu-${{ matrix.release }} | |
needs: build | |
# Default: 360 minutes | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
release: [22.04] #22.04 | |
steps: | |
- name: Download ${{ matrix.release }} debs | |
uses: actions/download-artifact@v1 | |
with: | |
name: debs-${{ matrix.release }} | |
- name: prepare local web server | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y apache2 devscripts debsigs apt-utils | |
sudo mkdir /var/www/html/repo | |
sudo chmod o+rw /var/www/html/repo | |
- name: start local web server | |
run: | | |
sudo service apache2 start | |
- name: get support libraries from OBS | |
run: | | |
cd /var/www/html/repo | |
wget -q -r -np -l2 -A "dsc,l*.deb" --no-host --cut-dirs 4 http://download.opensuse.org/repositories/home:/rgerhards/xUbuntu_22.04/ | |
ls -l | |
find . | |
- name: prepare gnupg signing key | |
run: | | |
cat >makegpg.conf <<EOF | |
%echo Generating a default key | |
Key-Type: RSA | |
Key-Length: 4096 | |
Subkey-Type: RSA | |
Subkey-Length: 4096 | |
Name-Real: RSYSLOG CI | |
Name-Comment: rsyslog | |
Name-Email: [email protected] | |
Expire-Date: 0 | |
%no-ask-passphrase | |
%no-protection | |
%transient-key | |
# Do a commit here, so that we can later print "done" :-) | |
%commit | |
%echo done | |
EOF | |
gpg --batch --gen-key makegpg.conf | |
- name: prepare repository | |
run: | | |
export PKG_KEY=$(gpg --keyid-format short --list-keys [email protected] |grep pub|sed 's~^.*/~~' |sed 's~ 2.*$~~') | |
export PKG_KEY_LONG=$(gpg --keyid-format long --list-keys [email protected] |grep pub|sed 's~^.*/~~' |sed 's~ 2.*$~~') | |
echo "Generated temp GPG key: $PKG_KEY / $PKG_KEY_LONG" | |
cd /var/www/html/repo | |
cat >signdebs.sh <<EOF | |
#!/bin/bash | |
for debfile in ./amd64/*.deb | |
do | |
echo "Resigning file \$debfile: debsigs --sign=origin -k $PKG_KEY_LONG \$debfile" | |
debsigs --sign=origin -k $PKG_KEY_LONG \$debfile | |
done | |
EOF | |
chmod +x signdebs.sh | |
echo Output GPG Signing Key to Release.key: | |
gpg --armor --output Release.key --export [email protected] | |
ls -l $GITHUB_WORKSPACE/debs-${{ matrix.release }} | |
set -o pipefail | |
# Do not FAIL pipe on error below | |
set +e | |
mv $GITHUB_WORKSPACE/debs-${{ matrix.release }}/*deb amd64 | |
mv $GITHUB_WORKSPACE/debs-${{ matrix.release }}/*dsc . | |
mv $GITHUB_WORKSPACE/debs-${{ matrix.release }}/*changes . | |
mv $GITHUB_WORKSPACE/debs-${{ matrix.release }}/*buildinfo . > /dev/null 2>&1 | |
set -e | |
echo LIST changes files: | |
ls -al *changes | |
echo doing debsign | |
debsign --re-sign ./*.changes -k$PKG_KEY_LONG | |
debsign --re-sign ./*.dsc -k$PKG_KEY_LONG | |
ls -l ./amd64/*.deb | |
./signdebs.sh | |
dpkg-scanpackages . /dev/null >Packages | |
xz --keep Packages | |
apt-ftparchive release ./ > Release | |
gpg --output Release.gpg --armor --detach-sig Release | |
# binary format -> gpg --output Release.gpg --detach-sig Release | |
echo "LIST /var/www/html/repo" | |
ls -al /var/www/html/repo | |
echo Packages: | |
cat Packages | |
echo Current Dir: | |
ls -al | |
cd $GITHUB_WORKSPACE | |
- name: save ${{ matrix.release }} DEB Repo | |
uses: actions/upload-artifact@v2 | |
with: | |
name: repo-${{ matrix.release }} | |
path: /var/www/html/repo | |
- name: install test new version | |
run: | | |
export PKG_KEY=$(gpg --keyid-format short --list-keys [email protected] |grep pub|sed 's~^.*/~~' |sed 's~ 2.*$~~') | |
export PKG_KEY_LONG=$(gpg --keyid-format long --list-keys [email protected] |grep pub|sed 's~^.*/~~' |sed 's~ 2.*$~~') | |
echo "Temp GPG key is: $PKG_KEY / $PKG_KEY_LONG" | |
# Add repository to local sources | |
echo "deb http://localhost/repo/ /" | sudo tee /etc/apt/sources.list.d/localhost.repo.list | |
wget -qO - http://localhost/repo/Release.key | sudo apt-key add - | |
# Perform apt update and install rsyslog packages | |
sudo apt-get clean | |
sudo apt-get update | |
sudo apt-cache search rsyslog | |
sudo apt-cache show rsyslog | |
sudo apt-get install -y rsyslog rsyslog-improg rsyslog-imkmsg | |
rsyslogd -v | |
sudo systemctl restart rsyslog | |
sudo systemctl status rsyslog | |
logger test1 | |
tail -n20 /var/log/syslog | |
grep "test1" /var/log/syslog --count || { echo "test1 not logged into /var/log/syslog" >&2; exit 1; } |