Skip to content

Commit 858f7b0

Browse files
Merge pull request #1492 from jpopelka/gitlab-mr-close
Parse also Gitlab-MR-closed event TODO: Write new tests or update the old ones to cover the new functionality. I need this for hardly, where we want to react when a source-git MR gets closed. Reviewed-by: Tomas Tomecek <tomas@tomecek.net>
2 parents 6be51f1 + 1bef28f commit 858f7b0

23 files changed

+297
-56
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ This repository contains [docker-compose.yml](./docker-compose.yml) for
4848
Before you run it, we suggest that you open the file and read all the comments.
4949
You can also run only certain pieces of packit-service for local development
5050
(e.g. worker, database or service/httpd).
51+
You also need to populate `secrets/packit/dev/` manually, for instructions
52+
see [deployment repo](https://github.com/packit/deployment/tree/main/secrets).
5153

5254
When you are running service/httpd and making requests to it,
5355
make sure that `server_name` configuration file in `packit-service.yaml` is set.

Makefile

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
BASE_IMAGE ?= quay.io/packit/base
2+
# true|false
3+
PULL_BASE_IMAGE ?= true
24
SERVICE_IMAGE ?= quay.io/packit/packit-service:dev
35
WORKER_IMAGE ?= quay.io/packit/packit-worker:dev
46
TEST_IMAGE ?= quay.io/packit/packit-service-tests:stg
7+
# missing|always|never
58
PULL_TEST_IMAGE ?= missing
69
TEST_TARGET ?= ./tests/unit ./tests/integration/
710
CONTAINER_ENGINE ?= $(shell command -v podman 2> /dev/null || echo docker)
@@ -16,21 +19,37 @@ COMPOSE ?= docker-compose
1619
MY_ID ?= `id -u`
1720

1821
service: files/install-deps.yaml files/recipe.yaml
19-
$(CONTAINER_ENGINE) pull $(BASE_IMAGE)
20-
$(CONTAINER_ENGINE) build --rm -t $(SERVICE_IMAGE) -f files/docker/Dockerfile --build-arg SOURCE_BRANCH=$(SOURCE_BRANCH) .
22+
$(CONTAINER_ENGINE) build --rm \
23+
--pull=$(PULL_BASE_IMAGE) \
24+
-t $(SERVICE_IMAGE) \
25+
-f files/docker/Dockerfile \
26+
--build-arg SOURCE_BRANCH=$(SOURCE_BRANCH) \
27+
.
2128

2229
worker: files/install-deps-worker.yaml files/recipe-worker.yaml
23-
$(CONTAINER_ENGINE) pull $(BASE_IMAGE)
24-
$(CONTAINER_ENGINE) build --rm -t $(WORKER_IMAGE) -f files/docker/Dockerfile.worker --build-arg SOURCE_BRANCH=$(SOURCE_BRANCH) .
30+
$(CONTAINER_ENGINE) build --rm \
31+
--pull=$(PULL_BASE_IMAGE) \
32+
-t $(WORKER_IMAGE) \
33+
-f files/docker/Dockerfile.worker \
34+
--build-arg SOURCE_BRANCH=$(SOURCE_BRANCH) \
35+
.
2536

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

3041
# In most cases you don't need to build your test-image, the one in registry should be all you need.
3142
build-test-image: files/install-deps-worker.yaml files/install-deps.yaml files/recipe-tests.yaml
32-
$(CONTAINER_ENGINE) build --rm -t $(TEST_IMAGE) -f files/docker/Dockerfile.tests --build-arg SOURCE_BRANCH=$(SOURCE_BRANCH) .
43+
$(CONTAINER_ENGINE) build --rm \
44+
-t $(TEST_IMAGE) \
45+
-f files/docker/Dockerfile.tests \
46+
--build-arg SOURCE_BRANCH=$(SOURCE_BRANCH) \
47+
.
3348

49+
# We use a test image pre-built (by Github action) from latest commit in main.
50+
# The PULL_TEST_IMAGE specifies whether the image is downloaded before running tests in a container.
51+
# Default is 'missing', which means that it's downloaded/updated ONLY if missing.
52+
# Set PULL_TEST_IMAGE=always to pull/update the test image before running tests.
3453
check-in-container:
3554
@# don't use -ti here in CI, TTY is not allocated in zuul
3655
echo $(SOURCE_BRANCH)

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ services:
5252
SOURCE_BRANCH: main
5353
image: quay.io/packit/packit-worker:dev
5454
command: /usr/bin/run_worker.sh
55-
#tty: true
5655
depends_on:
5756
- redis
5857
- postgres

files/check-inside-openshift.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,26 @@
2525
k8s:
2626
host: "{{ oc_server.stdout }}"
2727
api_key: "{{ kubeconfig_token.stdout }}"
28-
validate_certs: no
28+
validate_certs: false
2929
namespace: "{{ oc_project.stdout }}"
3030
resource_definition: "{{ lookup('file', './test-src-pvc.yaml') }}"
3131
- name: Start pod which mounts test-src-pvc to /src
3232
k8s:
3333
host: "{{ oc_server.stdout }}"
3434
api_key: "{{ kubeconfig_token.stdout }}"
35-
validate_certs: no
35+
validate_certs: false
3636
namespace: "{{ oc_project.stdout }}"
3737
resource_definition: "{{ lookup('file', './test-src-mounter.yaml') }}"
3838
- name: Wait for the pod to be running so we can rsync the files
3939
k8s:
4040
host: "{{ oc_server.stdout }}"
4141
api_key: "{{ kubeconfig_token.stdout }}"
42-
validate_certs: no
42+
validate_certs: false
4343
namespace: "{{ oc_project.stdout }}"
4444
name: mount-src
4545
api_version: v1
4646
kind: Pod
47-
wait: yes
47+
wait: true
4848
wait_condition:
4949
type: Ready
5050
wait_timeout: 100
@@ -54,7 +54,7 @@
5454
k8s:
5555
host: "{{ oc_server.stdout }}"
5656
api_key: "{{ kubeconfig_token.stdout }}"
57-
validate_certs: no
57+
validate_certs: false
5858
namespace: "{{ oc_project.stdout }}"
5959
name: mount-src
6060
api_version: v1
@@ -65,7 +65,7 @@
6565
k8s:
6666
host: "{{ oc_server.stdout }}"
6767
api_key: "{{ kubeconfig_token.stdout }}"
68-
validate_certs: no
68+
validate_certs: false
6969
namespace: "{{ oc_project.stdout }}"
7070
name: "{{ tests_job_name }}"
7171
api_version: v1
@@ -75,7 +75,7 @@
7575
k8s:
7676
host: "{{ oc_server.stdout }}"
7777
api_key: "{{ kubeconfig_token.stdout }}"
78-
validate_certs: no
78+
validate_certs: false
7979
namespace: "{{ oc_project.stdout }}"
8080
name: get-requre-data
8181
api_version: v1
@@ -85,13 +85,13 @@
8585
k8s:
8686
host: "{{ oc_server.stdout }}"
8787
api_key: "{{ kubeconfig_token.stdout }}"
88-
validate_certs: no
88+
validate_certs: false
8989
namespace: "{{ oc_project.stdout }}"
9090
name: test-data-pvc
9191
api_version: v1
9292
kind: PersistentVolumeClaim
9393
state: absent
94-
wait: yes
94+
wait: true
9595
wait_condition:
9696
type: Complete
9797
wait_timeout: 300
@@ -104,21 +104,21 @@
104104
k8s:
105105
host: "{{ oc_server.stdout }}"
106106
api_key: "{{ kubeconfig_token.stdout }}"
107-
validate_certs: no
107+
validate_certs: false
108108
namespace: "{{ oc_project.stdout }}"
109109
name: "{{ tests_job_name }}"
110110
api_version: v1
111111
kind: Job
112-
wait: yes
112+
wait: true
113113
wait_condition:
114114
type: Complete
115115
wait_timeout: 300
116-
ignore_errors: yes # we want to see logs either way
116+
ignore_errors: true # we want to see logs either way
117117
- name: get test results
118118
k8s_info:
119119
host: "{{ oc_server.stdout }}"
120120
api_key: "{{ kubeconfig_token.stdout }}"
121-
validate_certs: no
121+
validate_certs: false
122122
namespace: "{{ oc_project.stdout }}"
123123
kind: Job
124124
name: "{{ tests_job_name }}"
@@ -136,12 +136,12 @@
136136
k8s:
137137
host: "{{ oc_server.stdout }}"
138138
api_key: "{{ kubeconfig_token.stdout }}"
139-
validate_certs: no
139+
validate_certs: false
140140
namespace: "{{ oc_project.stdout }}"
141141
name: get-requre-data
142142
api_version: v1
143143
kind: Pod
144-
wait: yes
144+
wait: true
145145
wait_condition:
146146
type: Ready
147147
wait_timeout: 100

files/deployment-check.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the Packit project.
2+
# SPDX-License-Identifier: MIT
3+
14
---
25
- name: Check packit-service deployment
36
hosts: all

files/deployment.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the Packit project.
2+
# SPDX-License-Identifier: MIT
3+
14
---
25
# This file is the entrypoint to deploy packit-service to an openshift cluster (e.g. in Zuul)
36
- name: Deploy dev version of packit-service into zuul.
@@ -33,7 +36,7 @@
3336
git:
3437
repo: "https://github.com/packit/deployment.git"
3538
dest: "{{ deployment_dir }}"
36-
clone: yes
39+
clone: true
3740
when: zuul is not defined
3841

3942
- name: Generate secrets
@@ -61,7 +64,7 @@
6164
- name: get minishift ip
6265
command: minishift ip
6366
register: minishift_ip
64-
ignore_errors: True
67+
ignore_errors: true
6568

6669
- set_fact:
6770
cluster_ip: "{{ minishift_ip.stdout if not minishift_ip.failed else '127.0.0.1' }}"

files/install-deps-worker.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the Packit project.
2+
# SPDX-License-Identifier: MIT
3+
14
---
25
- name: Install dependencies for packit-service worker
36
hosts: all

files/install-deps.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the Packit project.
2+
# SPDX-License-Identifier: MIT
3+
14
---
25
- name: Install dependencies for packit-service
36
hosts: all
@@ -14,7 +17,6 @@
1417
# httpd & deps
1518
- python3-mod_wsgi
1619
- mod_ssl
17-
#- python3-packit # temporary workaround for sake of marhsmallow
1820
- python3-pip # not included in base fedora:31 image, needed for next task
1921
# temporary dependencies
2022
- krb5-devel

files/recipe-tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the Packit project.
2+
# SPDX-License-Identifier: MIT
3+
14
---
25
- name: This is a recipe for a container image where packit-service tests will run
36
hosts: all

files/recipe-worker.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the Packit project.
2+
# SPDX-License-Identifier: MIT
3+
14
---
25
- name: This is a recipe for how to cook with packit-service worker
36
hosts: all

0 commit comments

Comments
 (0)