Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
.PHONY: hardly test-image

BASE_IMAGE ?= quay.io/packit/packit-worker
# true|false
PULL_BASE_IMAGE ?= true
HARDLY_IMAGE ?= quay.io/packit/hardly:dev
TEST_IMAGE ?= hardly-tests
TEST_TARGET ?= ./tests/
Expand All @@ -14,16 +16,29 @@ COV_REPORT ?= term-missing
COLOR ?= yes
SOURCE_BRANCH ?= $(shell git branch --show-current)

# The 'hardly' image is built FROM quay.io/packit/packit-worker
# which is pulled/updated before the build.
# If you want to build from your local worker image,
# i.e. don't want to pull the base image,
# set PULL_BASE_IMAGE=false
hardly: files/recipe-hardly.yaml files/install-deps.yaml
$(CONTAINER_ENGINE) pull $(BASE_IMAGE)
$(CONTAINER_ENGINE) build --rm -t $(HARDLY_IMAGE) -f files/Containerfile --build-arg SOURCE_BRANCH=$(SOURCE_BRANCH) .
$(CONTAINER_ENGINE) build --rm \
--pull=$(PULL_BASE_IMAGE) \
-t $(HARDLY_IMAGE) \
-f files/Containerfile \
--build-arg SOURCE_BRANCH=$(SOURCE_BRANCH) \
.

check:
find . -name "*.pyc" -exec rm {} \;
PYTHONPATH=$(CURDIR) PYTHONDONTWRITEBYTECODE=1 python3 -m pytest --color=$(COLOR) --verbose --showlocals --cov=hardly --cov-report=$(COV_REPORT) $(TEST_TARGET)

test-image: files/recipe-tests.yaml
$(CONTAINER_ENGINE) build --rm -t $(TEST_IMAGE) -f files/Containerfile.tests --build-arg SOURCE_BRANCH=$(SOURCE_BRANCH) .
$(CONTAINER_ENGINE) build --rm \
-t $(TEST_IMAGE) \
-f files/Containerfile.tests \
--build-arg SOURCE_BRANCH=$(SOURCE_BRANCH) \
.

check-in-container:
@# don't use -ti here in CI, TTY is not allocated in zuul
Expand Down
2 changes: 1 addition & 1 deletion files/install-deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
tasks:
# - import_tasks: tasks/process-source-branch.yaml
- name: Install all RPM/python packages needed to run hardly
dnf:
ansible.builtin.dnf:
name:
- centpkg
- tig # for debugging, can be removed later
4 changes: 2 additions & 2 deletions files/recipe-hardly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
hosts: all
tasks:
- name: Rename run_worker.sh
command: mv /usr/bin/run_worker.sh /usr/bin/run_worker_.sh
ansible.builtin.command: mv /usr/bin/run_worker.sh /usr/bin/run_worker_.sh
- name: Install our run_worker.sh
copy:
ansible.builtin.copy:
src: run_worker.sh
dest: /usr/bin/
mode: 0777
2 changes: 1 addition & 1 deletion files/recipe-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
hosts: all
tasks:
- name: Install test RPM dependencies
dnf:
ansible.builtin.dnf:
name:
- python3-flexmock
- python3-pytest
Expand Down
2 changes: 1 addition & 1 deletion files/tasks/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Tasks common to all images

- name: make packit home dir
file:
ansible.builtin.file:
state: directory
path: "{{ home_path }}"
mode: 0776
27 changes: 0 additions & 27 deletions files/tasks/install-ogr-deps.yaml

This file was deleted.

42 changes: 0 additions & 42 deletions files/tasks/install-packit-deps.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions files/tasks/process-source-branch.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions files/zuul-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
hosts: all
tasks:
- name: Install podman
dnf:
ansible.builtin.dnf:
name:
- podman
state: present
become: true
# Fix the SELinux context for podman
- name: Create ~/.local/share/
file:
ansible.builtin.file:
path: ~/.local/share/
state: directory
recurse: yes
recurse: true
setype: data_home_t
- name: Build test image
command: "make test-image"
ansible.builtin.command: "make test-image"
args:
chdir: "{{ zuul.project.src_dir }}"
- name: Run tests within a container
command: "make check-in-container"
ansible.builtin.command: "make check-in-container"
args:
chdir: "{{ zuul.project.src_dir }}"
environment:
Expand Down
Loading