Commit 10676f10 authored by Tomas Krizek's avatar Tomas Krizek

Merge branch 'tests-pkgtest' into 'master'

Tests pkgtest

See merge request !1
parents 81d78f8f 27cab7f2
Pipeline #49036 passed with stage
in 42 seconds
......@@ -5,6 +5,7 @@ variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_STRATEGY: clone # sometimes unclean submodule dirs otherwise
RESPDIFF_PRIORITY: 5
DISTROTEST_PRIORITY: 6
RESPDIFF_COUNT: 1
RESPDIFF_FORCE: 0
RESPERF_FORCE: 0
......@@ -21,12 +22,16 @@ stages:
- test
- extended
- deploy
- deploy-test
# build {{{
.build: &build
stage: build
except:
- master
refs:
- master
variables:
- $SKIP_CI == "1"
artifacts:
when: always
paths:
......@@ -43,6 +48,7 @@ archive:
variables:
GIT_COMMITER_NAME: 'ci'
EMAIL: 'ci@nic'
except: null
script:
- ./scripts/make-dev-archive.sh
......@@ -96,7 +102,10 @@ kres-gen:
.test: &test
stage: test
except:
- master
refs:
- master
variables:
- $SKIP_CI == "1"
tags:
- docker
- linux
......@@ -123,7 +132,10 @@ kres-gen:
.test_nodep: &test_nodep
stage: test
except:
- master
refs:
- master
variables:
- $SKIP_CI == "1"
dependencies: [] # do not download build artifacts
tags:
- docker
......@@ -218,7 +230,10 @@ lint:tidy:
.pkgbuild: &pkgbuild
stage: test
except:
- master
refs:
- master
variables:
- $SKIP_CI == "1"
image: $CI_REGISTRY/knot/knot-resolver/ci/fedora
only: # trigger job only in repos under our control
- branches@knot/knot-resolver
......@@ -313,7 +328,10 @@ pytests:
- branches@knot/knot-resolver
- branches@knot/knot-resolver-security
except:
- master
refs:
- master
variables:
- $SKIP_CI == "1"
script:
- git diff-index --name-only origin/master | grep -qEv '^(AUTHORS|ci/|config.mk|COPYING|distro/|doc/|etc/|NEWS|README.md|scripts/|tests/|\.gitignore|\.gitlab-ci\.yml|\.travis\.yml)' || test $RESPDIFF_FORCE -gt 0 || exit 0
- export LABEL=gl$(date +%s)
......@@ -383,7 +401,10 @@ fwd-udp6-unbound.tls6:
- branches@knot/knot-resolver
- branches@knot/knot-resolver-security
except:
- master
refs:
- master
variables:
- $SKIP_CI == "1"
script:
- git diff-index --name-only origin/master | grep -qEv '^(AUTHORS|ci/|config.mk|COPYING|distro/|doc/|etc/|NEWS|README.md|scripts/|tests/|\.gitignore|\.gitlab-ci\.yml|\.travis\.yml)' || test $RESPERF_FORCE -gt 0 || exit 0
- export LABEL=gl$(date +%s)
......@@ -424,20 +445,29 @@ resperf:iter.udp-asan:
# }}}
# deploy {{{
pkg:obs:devel:
obs:trigger: &obs_trigger
stage: deploy
only:
variables:
- $OBS_BUILD == "1"
refs:
- nightly@knot/knot-resolver
- $OBS_REPO
dependencies:
- archive
environment:
name: OBS/$OBS_REPO
url: https://build.opensuse.org/package/show/home:CZ-NIC:$OBS_REPO/knot-resolver
tags:
- respdiff
script:
- scripts/make-distrofiles.sh
- echo -e "[general]\napiurl = https://api.opensuse.org\n\n[https://api.opensuse.org]\nuser = CZ-NIC-automation\npass = $OBS_PASSWORD" > /root/.oscrc
- scripts/build-in-obs.sh knot-dns-devel # build against latest development version of knot
- scripts/build-in-obs.sh knot-resolver-devel # build against knot in knot-resolver-latest
- scripts/build-in-obs.sh $OBS_REPO
obs:release:
<<: *obs_trigger
only:
- tags
variables:
OBS_REPO: knot-resolver-devel # TODO change to latest
when: manual
# copy snapshot of current master to nightly branch for further processing
# (this is workaround for missing complex conditions for job limits in Gitlab)
......@@ -457,3 +487,104 @@ nightly:copy:
- 'curl --request POST --header "PRIVATE-TOKEN: $GITLAB_API_TOKEN" "https://gitlab.labs.nic.cz/api/v4/projects/147/repository/branches?branch=nightly&ref=master"'
- 'curl --request PUT --header "PRIVATE-TOKEN: $GITLAB_API_TOKEN" "https://gitlab.labs.nic.cz/api/v4/projects/147/repository/branches/nightly/protect"'
# }}}
# deploy-test {{{
.distrotest: &distrotest
stage: deploy-test
only:
variables:
- $OBS_REPO
- $CI_COMMIT_TAG
variables:
OBS_REPO: knot-resolver-latest
when: delayed
start_in: 3 minutes # give OBS build some time
tags:
- respdiff
script:
- "osc results home:CZ-NIC:$OBS_REPO knot-resolver -a x86_64 -r $DISTROTEST_REPO -w"
- >
osc results home:CZ-NIC:$OBS_REPO knot-resolver -a x86_64 -r $DISTROTEST_REPO --csv | grep 'succeeded|$' -q || \
(echo "ERROR: build failed"; exit 1)
- export LABEL=gl$(date +%s)
- export COMMITDIR="/var/tmp/respdiff-jobs/$(git rev-parse --short HEAD)-$LABEL"
- export TESTDIR="$COMMITDIR/distrotest.$DISTROTEST_NAME"
- ln -s $COMMITDIR distrotest_commitdir
- sudo -u respdiff /var/opt/respdiff/contrib/job_manager/submit.py -w
-p $DISTROTEST_PRIORITY
$(sudo -u respdiff /var/opt/respdiff/contrib/job_manager/create.py
"$(git rev-parse --short HEAD)" -l $LABEL -t distrotest.$DISTROTEST_NAME)
- export EXITCODE=$(cat $TESTDIR/j*_exitcode)
- if [[ "$EXITCODE" != "0" ]]; then cat $TESTDIR/j*_vagrant.log; fi
- exit $EXITCODE
after_script:
- 'cp -t . distrotest_commitdir/distrotest.$DISTROTEST_NAME/j* ||:'
artifacts:
when: always
expire_in: 1 week
paths:
- ./j*
obs:centos7:x86_64:
<<: *distrotest
variables:
DISTROTEST_NAME: centos7
DISTROTEST_REPO: CentOS_7_EPEL
obs:debian9:x86_64:
<<: *distrotest
variables:
DISTROTEST_NAME: debian9
DISTROTEST_REPO: Debian_9.0
obs:fedora29:x86_64:
<<: *distrotest
variables:
DISTROTEST_NAME: fedora29
DISTROTEST_REPO: Fedora_29
obs:fedora30:x86_64:
<<: *distrotest
variables:
DISTROTEST_NAME: fedora30
DISTROTEST_REPO: Fedora_30
obs:leap15:x86_64:
<<: *distrotest
variables:
DISTROTEST_NAME: leap15
DISTROTEST_REPO: openSUSE_Leap_15.0
obs:ubuntu1604:x86_64:
<<: *distrotest
variables:
DISTROTEST_NAME: ubuntu1604
DISTROTEST_REPO: xUbuntu_16.04
obs:ubuntu1804:x86_64:
<<: *distrotest
variables:
DISTROTEST_NAME: ubuntu1804
DISTROTEST_REPO: xUbuntu_18.04
obs:ubuntu1904:x86_64:
<<: *distrotest
variables:
DISTROTEST_NAME: ubuntu1904
DISTROTEST_REPO: xUbuntu_19.04
obs:build:all:
stage: deploy-test
only:
variables:
- $OBS_REPO
when: delayed
start_in: 3 minutes # give OBS build some time
tags:
- respdiff
script:
- "osc results home:CZ-NIC:$OBS_REPO knot-resolver -w"
- >
osc results home:CZ-NIC:$OBS_REPO knot-resolver --csv | grep 'succeeded|$' -q || \
(echo "ERROR: build(s) failed"; exit 1)
# }}}
......@@ -203,10 +203,12 @@ getent group knot-resolver >/dev/null || groupadd -r knot-resolver
getent passwd knot-resolver >/dev/null || useradd -r -g knot-resolver -d %{_sysconfdir}/knot-resolver -s /sbin/nologin -c "Knot Resolver" knot-resolver
%post
%systemd_post 'kresd@*.service'
%if 0%{?fedora}
# https://fedoraproject.org/wiki/Changes/Removing_ldconfig_scriptlets
systemctl daemon-reload
%systemd_post 'system-kresd.slice'
%else
%systemd_post 'kresd@*.service'
/sbin/ldconfig
%endif
......
......@@ -16,4 +16,9 @@ Vagrant.configure(2) do |config|
end
end
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 512
end
end
......@@ -13,4 +13,9 @@ Vagrant.configure(2) do |config|
end
end
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 512
end
end
......@@ -16,4 +16,9 @@ Vagrant.configure(2) do |config|
end
end
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 512
end
end
......@@ -16,4 +16,9 @@ Vagrant.configure(2) do |config|
end
end
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 512
end
end
......@@ -4,13 +4,21 @@
Vagrant.configure(2) do |config|
config.vm.box = "opensuse/openSUSE-Tumbleweed-x86_64"
config.vm.box = "fedora/30-cloud-base"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "tumbleweed_knot-resolver" do |machine|
config.vm.define "fedora30_knot-resolver" do |machine|
machine.vm.provision "ansible" do |ansible|
ansible.playbook = "../knot-resolver-pkgtest.yaml"
ansible.extra_vars = {
ansible_python_interpreter: "/usr/bin/python3"
}
end
end
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 512
end
end
---
- hosts: all
remote_user: root
become: true
vars:
dig_package:
Debian: dnsutils
Ubuntu: dnsutils
Fedora: bind-utils
CentOS: bind-utils
openSUSE Leap: bind-utils
openSUSE Tumbleweed: bind-utils
Archlinux: bind-tools
configure_obs_repo:
Fedora: |
dnf config-manager --add-repo https://download.opensuse.org/repositories/home:CZ-NIC:{{ item }}/Fedora_{{ ansible_distribution_major_version }}/home:CZ-NIC:{{ item }}.repo
CentOS: |
yum install -y wget &&
wget -i wget https://download.opensuse.org/repositories/home:CZ-NIC:{{ item }}/CentOS_7_EPEL/home:CZ-NIC:{{ item }}.repo -O /etc/yum.repos.d/home:CZ-NIC:{{ item }}.repo
Debian: |
echo 'deb http://download.opensuse.org/repositories/home:/CZ-NIC:/{{ item }}/Debian_9.0/ /' > /etc/apt/sources.list.d/{{ item }}.list &&
wget -nv https://download.opensuse.org/repositories/home:CZ-NIC:{{ item }}/Debian_9.0/Release.key -O Release.key &&
apt-key add - < Release.key &&
apt-get update
Ubuntu: |
echo 'deb http://download.opensuse.org/repositories/home:/CZ-NIC:/{{ item }}/xUbuntu_{{ ansible_distribution_version }}/ /' > /etc/apt/sources.list.d/{{ item }}.list &&
wget -nv https://download.opensuse.org/repositories/home:CZ-NIC:{{ item }}/xUbuntu_{{ ansible_distribution_version }}/Release.key -O Release.key &&
apt-key add - < Release.key &&
apt-get update
openSUSE Tumbleweed: |
zypper addrepo https://download.opensuse.org/repositories/home:CZ-NIC:{{ item }}/openSUSE_Tumbleweed/home:CZ-NIC:{{ item }}.repo &&
zypper --gpg-auto-import-keys refresh
openSUSE Leap: |
zypper addrepo https://download.opensuse.org/repositories/home:CZ-NIC:{{ item }}/openSUSE_Leap_15.0/home:CZ-NIC:{{ item }}.repo &&
zypper --gpg-auto-import-keys refresh
show_package_version:
Archlinux:
pacman -Qi knot-resolver | grep '^Version'
Fedora: &pkg_version_rpm |
rpm -qi knot-resolver | grep '^Version'
CentOS: *pkg_version_rpm
openSUSE Leap: *pkg_version_rpm
openSUSE Tumbleweed: *pkg_version_rpm
Debian:
dpkg -s knot-resolver | grep '^Version'
Ubuntu: |
dpkg -s knot-resolver | grep '^Version'
vars_files:
- repos.yaml
gather_facts: false
pre_tasks:
- name: install python3 (Arch)
raw: |
(pacman-key --init && pacman-key --populate archlinux && \
pacman -Sy python3 --noconfirm) || :
ignore_errors: true
- name: gather facts
setup:
tasks:
- name: install epel
package:
name: epel-release
state: present
when: ansible_distribution == 'CentOS'
- name: configure OBS repository
shell: "{{ configure_obs_repo[ansible_distribution] }}"
args:
warn: false
with_items: "{{ repos }}"
when: ansible_distribution_file_variety != 'Archlinux'
- block:
- name: configure OBS repository (Arch)
blockinfile:
block: |
[home_CZ-NIC_{{ item }}_Arch]
SigLevel = Never
Server = https://download.opensuse.org/repositories/home:/CZ-NIC:/{{ item }}/Arch/$arch
insertbefore: '^\[core\]'
path: /etc/pacman.conf
state: present
with_items: "{{ repos }}"
- name: set up package mirrors
copy:
content: |
## Arch Linux repository mirrorlist
## Generated on 2018-12-10
## Czechia
Server = http://mirrors.nic.cz/archlinux/$repo/os/$arch
Server = http://ftp.fi.muni.cz/pub/linux/arch/$repo/os/$arch
Server = http://ftp.sh.cvut.cz/arch/$repo/os/$arch
Server = http://gluttony.sin.cvut.cz/arch/$repo/os/$arch
dest: /etc/pacman.d/mirrorlist
- name: sync repos (Arch)
shell: pacman -Syu --noconfirm
args:
warn: false
when: ansible_distribution_file_variety == 'Archlinux'
- name: install dig
package:
name: "{{ dig_package[ansible_distribution] }}"
state: present
- name: install knot-resolver
package:
name: knot-resolver
state: latest
- name: get installed package version
shell: "{{ show_package_version[ansible_distribution] }}"
args:
warn: false
register: package_version
- name: testing block
block:
- name: start kresd@1.service
service:
name: kresd@1.service
state: restarted
- name: resolve nic.cz
shell: dig @127.0.0.1 nic.cz
register: res
failed_when: '"status: NOERROR" not in res.stdout'
- name: test dnssec is turned on
block:
- name: test dnssec-failed.org +cd returns NOERROR
shell: dig +cd @127.0.0.1 dnssec-failed.org
register: res
failed_when: '"status: NOERROR" not in res.stdout'
- name: test dnssec-failed.org returns SERVFAIL
shell: dig @127.0.0.1 dnssec-failed.org
register: res
failed_when: '"status: SERVFAIL" not in res.stdout'
always:
- name: show installed version
debug:
var: package_version.stdout
......@@ -13,4 +13,9 @@ Vagrant.configure(2) do |config|
end
end
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 512
end
end
#!/bin/bash -x
# ./test-distro.sh {devel|latest} {distro}
# Example usage: ./test-distro.sh devel debian9
# ./test-distro.sh {obs_repo} {distro}
# Example usage: ./test-distro.sh knot-resolver-devel debian9
pkgtestdir="$(dirname ${0})"
repofile="$pkgtestdir/repos.yaml"
distro=$2
repo=$1
# Select repos
echo -e 'repos:\n - knot-resolver-latest' > repos.yaml # latest is needed for knot
case "$repo" in
devel)
echo -e ' - knot-resolver-devel' >> repos.yaml
;;
testing)
echo -e 'repos:\n - knot-resolver-testing' > repos.yaml
;;
latest)
;;
*)
echo "Unknown repo, choose devel|latest|testing"
exit 1
;;
esac
echo -e "repos:\n - $repo" > $repofile
if [ "$repo" == "knot-resolver-devel" ]; then
# get Knot DNS from knot-resolver-latest
echo -e ' - knot-resolver-latest' >> $repofile
fi
cd "$distro"
pushd "$pkgtestdir/$distro"
vagrant destroy -f &>/dev/null
vagrant up
ret=$?
vagrant destroy -f &>/dev/null
popd
exit $ret
......@@ -16,4 +16,9 @@ Vagrant.configure(2) do |config|
end
end
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 512
end
end
......@@ -16,4 +16,9 @@ Vagrant.configure(2) do |config|
end
end
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 512
end
end
......@@ -16,4 +16,9 @@ Vagrant.configure(2) do |config|
end
end
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 512
end
end
......@@ -4,13 +4,21 @@
Vagrant.configure(2) do |config|
config.vm.box = "archlinux/archlinux"
config.vm.box = "generic/ubuntu1904"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "arch_knot-resolver" do |machine|
config.vm.define "ubuntu1904_knot-resolver" do |machine|
machine.vm.provision "ansible" do |ansible|
ansible.playbook = "../knot-resolver-test.yaml"
ansible.playbook = "../knot-resolver-pkgtest.yaml"
ansible.extra_vars = {
ansible_python_interpreter: "/usr/bin/python3"
}
end
end
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 512
end
end
../.ansible.cfg
\ No newline at end of file
......@@ -2,7 +2,7 @@
# Example usage:
# 1. place tarball to be released in git root dir
# 2. scripts/make-distrofiles.sh -s
# 2. scripts/make-distrofiles.sh
# 3. scripts/build-in-obs.sh knot-resolver-latest
project=home:CZ-NIC:$1
......
......@@ -2,26 +2,12 @@
set -o errexit -o nounset -o xtrace
cd "$(dirname ${0})/.."
PKGDIR="build_dist/meson-dist"
# Run with -s to include *.symbols files.
pkgdir="build_dist/meson-dist"
package=knot-resolver
withsymbols=false
while getopts "s" o; do
case "${o}" in
s)
withsymbols=true
;;
*)
;;
esac
done
shift $((OPTIND-1))
pushd ${PKGDIR}
pushd ${pkgdir}
version=$(ls ${package}*.tar.xz | sed "s/${package}-\(.*\).tar.xz/\1/")
popd
......@@ -40,18 +26,13 @@ done
# Rename archive to debian format
pkgname="${package}-${version}"
debname="${package}_${version}.orig"
cp "${PKGDIR}/${pkgname}.tar.xz" "${debname}.tar.xz"
cp "${pkgdir}/${pkgname}.tar.xz" "${debname}.tar.xz"
# Prepare clean debian-specific directory
tar -xf "${debname}.tar.xz"
pushd "${pkgname}" > /dev/null
cp -arL ../distro/deb debian
# Optionally remove symbols file
if [ "$withsymbols" = false ]; then
rm -f debian/*.symbols
fi
# Create debian archive and dsc
dpkg-source -b .
popd > /dev/null
#!/bin/bash
#
# Builds the checked out version in knot-dns-testing OBS repository
# Builds the checked out version in OBS repository
set -o errexit -o nounset -o xtrace
force=false
# Read options
while getopts "f" o; do
case "${o}" in
f)
force=true
;;
*)
;;
esac
done
shift $((OPTIND-1))
obs_repo=$1
# Clean working tree
if [[ $(git status --porcelain | wc -l) -ne 0 ]]; then
if [ "$force" = false ]; then
echo "working tree dirty. force clean with '-f'"
exit 1
fi
git clean -dfx
git reset --hard
echo "working tree dirty: git clean -dfx && git reset --hard"
exit 1
fi
# Create tarball
......@@ -33,6 +17,6 @@ scripts/make-dev-archive.sh
# Submit to OBS
scripts/make-distrofiles.sh -s
scripts/build-in-obs.sh knot-resolver-testing
scripts/build-in-obs.sh $obs_repo
echo "Check results at https://build.opensuse.org/package/show/home:CZ-NIC:knot-resolver-testing/knot-resolver"
echo "Check results at https://build.opensuse.org/package/show/home:CZ-NIC:$obs_repo/knot-resolver"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment