Skip to content

Commit a9cf515

Browse files
authored
Is1877/allow constraints on director services (#1878)
* added DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS variable
1 parent 217aac9 commit a9cf515

File tree

12 files changed

+85
-56
lines changed

12 files changed

+85
-56
lines changed

.github/workflows/ci-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ jobs:
2424
- name: set target variable
2525
run: |
2626
target=$(git name-rev --refs="refs/remotes/origin/*" --name-only ${GITHUB_SHA})
27-
echo ::set-env name=TARGET::${target}
27+
echo "TARGET=${target}" >> $GITHUB_ENV
2828
- name: setup docker
2929
run: |
3030
sudo ./ci/github/helpers/setup_docker_compose.bash
3131
./ci/github/helpers/setup_docker_experimental.bash
3232
./ci/github/helpers/setup_docker_buildx.bash
33-
echo ::set-env name=DOCKER_BUILDX::1
33+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
3434
- name: set owner variable
35-
run: echo ::set-env name=OWNER::${GITHUB_REPOSITORY%/*}
35+
run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
3636
- name: set git tag
37-
run: echo ::set-env name=GIT_TAG::${GITHUB_REF##*/}
37+
run: echo "GIT_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
3838
- if: env.TARGET == 'remotes/origin/master'
3939
env:
4040
FROM_TAG_PREFIX: staging-github

.github/workflows/ci-staging.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626
sudo ./ci/github/helpers/setup_docker_compose.bash
2727
./ci/github/helpers/setup_docker_experimental.bash
2828
./ci/github/helpers/setup_docker_buildx.bash
29-
echo ::set-env name=DOCKER_BUILDX::1
29+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
3030
- name: set owner variable
31-
run: echo ::set-env name=OWNER::${GITHUB_REPOSITORY%/*}
31+
run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
3232
- name: set git tag
33-
run: echo ::set-env name=GIT_TAG::${GITHUB_REF##*/}
33+
run: echo "GIT_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
3434
- name: deploy
3535
run: ./ci/deploy/dockerhub-tag-version.bash

.github/workflows/ci-testing-deploy.yml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
sudo ./ci/github/helpers/setup_docker_compose.bash
5050
./ci/github/helpers/setup_docker_experimental.bash
5151
./ci/github/helpers/setup_docker_buildx.bash
52-
echo ::set-env name=DOCKER_BUILDX::1
52+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
5353
- name: setup python environment
5454
uses: actions/setup-python@v2
5555
with:
@@ -85,7 +85,7 @@ jobs:
8585
sudo ./ci/github/helpers/setup_docker_compose.bash
8686
./ci/github/helpers/setup_docker_experimental.bash
8787
./ci/github/helpers/setup_docker_buildx.bash
88-
echo ::set-env name=DOCKER_BUILDX::1
88+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
8989
- name: setup python environment
9090
uses: actions/setup-python@v2
9191
with:
@@ -134,7 +134,7 @@ jobs:
134134
sudo ./ci/github/helpers/setup_docker_compose.bash
135135
./ci/github/helpers/setup_docker_experimental.bash
136136
./ci/github/helpers/setup_docker_buildx.bash
137-
echo ::set-env name=DOCKER_BUILDX::1
137+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
138138
- name: setup python environment
139139
uses: actions/setup-python@v2
140140
with:
@@ -189,7 +189,7 @@ jobs:
189189
sudo ./ci/github/helpers/setup_docker_compose.bash
190190
./ci/github/helpers/setup_docker_experimental.bash
191191
./ci/github/helpers/setup_docker_buildx.bash
192-
echo ::set-env name=DOCKER_BUILDX::1
192+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
193193
- name: setup python environment
194194
uses: actions/setup-python@v2
195195
with:
@@ -238,7 +238,7 @@ jobs:
238238
sudo ./ci/github/helpers/setup_docker_compose.bash
239239
./ci/github/helpers/setup_docker_experimental.bash
240240
./ci/github/helpers/setup_docker_buildx.bash
241-
echo ::set-env name=DOCKER_BUILDX::1
241+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
242242
- name: setup python environment
243243
uses: actions/setup-python@v2
244244
with:
@@ -287,7 +287,7 @@ jobs:
287287
sudo ./ci/github/helpers/setup_docker_compose.bash
288288
./ci/github/helpers/setup_docker_experimental.bash
289289
./ci/github/helpers/setup_docker_buildx.bash
290-
echo ::set-env name=DOCKER_BUILDX::1
290+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
291291
- uses: actions/setup-node@v1
292292
with:
293293
node-version: ${{ matrix.node }}
@@ -317,7 +317,7 @@ jobs:
317317
sudo ./ci/github/helpers/setup_docker_compose.bash
318318
./ci/github/helpers/setup_docker_experimental.bash
319319
./ci/github/helpers/setup_docker_buildx.bash
320-
echo ::set-env name=DOCKER_BUILDX::1
320+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
321321
- name: setup python environment
322322
uses: actions/setup-python@v2
323323
with:
@@ -353,7 +353,7 @@ jobs:
353353
sudo ./ci/github/helpers/setup_docker_compose.bash
354354
./ci/github/helpers/setup_docker_experimental.bash
355355
./ci/github/helpers/setup_docker_buildx.bash
356-
echo ::set-env name=DOCKER_BUILDX::1
356+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
357357
- name: setup python environment
358358
uses: actions/setup-python@v2
359359
with:
@@ -402,7 +402,7 @@ jobs:
402402
sudo ./ci/github/helpers/setup_docker_compose.bash
403403
./ci/github/helpers/setup_docker_experimental.bash
404404
./ci/github/helpers/setup_docker_buildx.bash
405-
echo ::set-env name=DOCKER_BUILDX::1
405+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
406406
- name: setup python environment
407407
uses: actions/setup-python@v2
408408
with:
@@ -451,7 +451,7 @@ jobs:
451451
sudo ./ci/github/helpers/setup_docker_compose.bash
452452
./ci/github/helpers/setup_docker_experimental.bash
453453
./ci/github/helpers/setup_docker_buildx.bash
454-
echo ::set-env name=DOCKER_BUILDX::1
454+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
455455
- name: setup python environment
456456
uses: actions/setup-python@v2
457457
with:
@@ -500,7 +500,7 @@ jobs:
500500
sudo ./ci/github/helpers/setup_docker_compose.bash
501501
./ci/github/helpers/setup_docker_experimental.bash
502502
./ci/github/helpers/setup_docker_buildx.bash
503-
echo ::set-env name=DOCKER_BUILDX::1
503+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
504504
- name: setup python environment
505505
uses: actions/setup-python@v2
506506
with:
@@ -549,7 +549,7 @@ jobs:
549549
sudo ./ci/github/helpers/setup_docker_compose.bash
550550
./ci/github/helpers/setup_docker_experimental.bash
551551
./ci/github/helpers/setup_docker_buildx.bash
552-
echo ::set-env name=DOCKER_BUILDX::1
552+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
553553
- name: setup python environment
554554
uses: actions/setup-python@v2
555555
with:
@@ -599,7 +599,7 @@ jobs:
599599
sudo ./ci/github/helpers/setup_docker_compose.bash
600600
./ci/github/helpers/setup_docker_experimental.bash
601601
./ci/github/helpers/setup_docker_buildx.bash
602-
echo ::set-env name=DOCKER_BUILDX::1
602+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
603603
- name: setup python environment
604604
uses: actions/setup-python@v2
605605
with:
@@ -649,7 +649,7 @@ jobs:
649649
sudo ./ci/github/helpers/setup_docker_compose.bash
650650
./ci/github/helpers/setup_docker_experimental.bash
651651
./ci/github/helpers/setup_docker_buildx.bash
652-
echo ::set-env name=DOCKER_BUILDX::1
652+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
653653
- name: setup python environment
654654
uses: actions/setup-python@v2
655655
with:
@@ -699,7 +699,7 @@ jobs:
699699
sudo ./ci/github/helpers/setup_docker_compose.bash
700700
./ci/github/helpers/setup_docker_experimental.bash
701701
./ci/github/helpers/setup_docker_buildx.bash
702-
echo ::set-env name=DOCKER_BUILDX::1
702+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
703703
- name: setup python environment
704704
uses: actions/setup-python@v2
705705
with:
@@ -749,7 +749,7 @@ jobs:
749749
sudo ./ci/github/helpers/setup_docker_compose.bash
750750
./ci/github/helpers/setup_docker_experimental.bash
751751
./ci/github/helpers/setup_docker_buildx.bash
752-
echo ::set-env name=DOCKER_BUILDX::1
752+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
753753
- name: setup python environment
754754
uses: actions/setup-python@v2
755755
with:
@@ -795,7 +795,7 @@ jobs:
795795
sudo ./ci/github/helpers/setup_docker_compose.bash
796796
./ci/github/helpers/setup_docker_experimental.bash
797797
./ci/github/helpers/setup_docker_buildx.bash
798-
echo ::set-env name=DOCKER_BUILDX::1
798+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
799799
- name: show system environs
800800
if: github.event_name == 'push'
801801
run: ./ci/helpers/show_system_versions.bash
@@ -807,7 +807,7 @@ jobs:
807807
run: ./ci/build/test-images.bash build_images
808808
- name: set owner variable
809809
if: github.event_name == 'push'
810-
run: echo ::set-env name=OWNER::${GITHUB_REPOSITORY%/*}
810+
run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
811811
- name: push images
812812
# only pushes have access to the docker credentials
813813
if: github.event_name == 'push'
@@ -828,14 +828,14 @@ jobs:
828828
if: github.event_name == 'pull_request'
829829
run: |
830830
export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*}
831-
echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,}
831+
echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV
832832
- uses: actions/checkout@v2
833833
- name: setup docker
834834
run: |
835835
sudo ./ci/github/helpers/setup_docker_compose.bash
836836
./ci/github/helpers/setup_docker_experimental.bash
837837
./ci/github/helpers/setup_docker_buildx.bash
838-
echo ::set-env name=DOCKER_BUILDX::1
838+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
839839
- name: setup python environment
840840
uses: actions/setup-python@v2
841841
with:
@@ -893,14 +893,14 @@ jobs:
893893
if: github.event_name == 'pull_request'
894894
run: |
895895
export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*}
896-
echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,}
896+
echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV
897897
- uses: actions/checkout@v2
898898
- name: setup docker
899899
run: |
900900
sudo ./ci/github/helpers/setup_docker_compose.bash
901901
./ci/github/helpers/setup_docker_experimental.bash
902902
./ci/github/helpers/setup_docker_buildx.bash
903-
echo ::set-env name=DOCKER_BUILDX::1
903+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
904904
- name: setup python environment
905905
uses: actions/setup-python@v2
906906
with:
@@ -958,14 +958,14 @@ jobs:
958958
if: github.event_name == 'pull_request'
959959
run: |
960960
export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*}
961-
echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,}
961+
echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV
962962
- uses: actions/checkout@v2
963963
- name: setup docker
964964
run: |
965965
sudo ./ci/github/helpers/setup_docker_compose.bash
966966
./ci/github/helpers/setup_docker_experimental.bash
967967
./ci/github/helpers/setup_docker_buildx.bash
968-
echo ::set-env name=DOCKER_BUILDX::1
968+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
969969
- name: setup python environment
970970
uses: actions/setup-python@v2
971971
with:
@@ -1023,14 +1023,14 @@ jobs:
10231023
if: github.event_name == 'pull_request'
10241024
run: |
10251025
export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*}
1026-
echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,}
1026+
echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV
10271027
- uses: actions/checkout@v2
10281028
- name: setup docker
10291029
run: |
10301030
sudo ./ci/github/helpers/setup_docker_compose.bash
10311031
./ci/github/helpers/setup_docker_experimental.bash
10321032
./ci/github/helpers/setup_docker_buildx.bash
1033-
echo ::set-env name=DOCKER_BUILDX::1
1033+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
10341034
- name: setup python environment
10351035
uses: actions/setup-python@v2
10361036
with:
@@ -1072,14 +1072,14 @@ jobs:
10721072
if: github.event_name == 'pull_request'
10731073
run: |
10741074
export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*}
1075-
echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,}
1075+
echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV
10761076
- uses: actions/checkout@v2
10771077
- name: setup docker
10781078
run: |
10791079
sudo ./ci/github/helpers/setup_docker_compose.bash
10801080
./ci/github/helpers/setup_docker_experimental.bash
10811081
./ci/github/helpers/setup_docker_buildx.bash
1082-
echo ::set-env name=DOCKER_BUILDX::1
1082+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
10831083
- name: setup python environment
10841084
uses: actions/setup-python@v2
10851085
with:
@@ -1152,7 +1152,7 @@ jobs:
11521152
if: github.event_name == 'pull_request'
11531153
run: |
11541154
export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*}
1155-
echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,}
1155+
echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV
11561156
- uses: actions/checkout@v2
11571157
- name: setup python environment
11581158
uses: actions/setup-python@v2
@@ -1307,9 +1307,9 @@ jobs:
13071307
sudo ./ci/github/helpers/setup_docker_compose.bash
13081308
./ci/github/helpers/setup_docker_experimental.bash
13091309
./ci/github/helpers/setup_docker_buildx.bash
1310-
echo ::set-env name=DOCKER_BUILDX::1
1310+
echo "DOCKER_BUILDX=1" >> $GITHUB_ENV
13111311
- name: set owner variable
1312-
run: echo ::set-env name=OWNER::${GITHUB_REPOSITORY%/*}
1312+
run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
13131313
- name: deploy master
13141314
if: github.ref == 'refs/heads/master'
13151315
env:

packages/pytest-simcore/src/pytest_simcore/postgres_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def create_template_db(postgres_dsn: Dict, postgres_engine: sa.engine.Engine) ->
4343
queries = [
4444
# disconnect existing users
4545
f"""
46-
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
46+
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
4747
WHERE pg_stat_activity.datname = '{postgres_dsn["database"]}' AND pid <> pg_backend_pid();
4848
""",
4949
# drop template database
@@ -116,7 +116,7 @@ def database_from_template_before_each_function(
116116
queries = [
117117
# terminate existing connections to the database
118118
f"""
119-
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
119+
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
120120
WHERE pg_stat_activity.datname = '{postgres_dsn["database"]}';
121121
""",
122122
# drop database
@@ -209,7 +209,7 @@ def postgres_session(postgres_db: sa.engine.Engine) -> sa.orm.session.Session:
209209

210210
@tenacity.retry(
211211
wait=tenacity.wait_fixed(5),
212-
stop=tenacity.stop_after_attempt(20),
212+
stop=tenacity.stop_after_attempt(60),
213213
before_sleep=tenacity.before_sleep_log(log, logging.INFO),
214214
reraise=True,
215215
)

packages/pytest-simcore/src/pytest_simcore/rabbit_service.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
# pylint:disable=unused-argument
33
# pylint:disable=redefined-outer-name
44

5+
import logging
56
import os
67
import socket
78
from typing import Any, Dict, Optional, Tuple
89

910
import aio_pika
1011
import pytest
1112
import tenacity
12-
from servicelib.rabbitmq_utils import RabbitMQRetryPolicyUponInitialization
1313
from simcore_sdk.config.rabbit import Config
1414

1515
from .helpers.utils_docker import get_service_published_port
1616

17+
log = logging.getLogger(__name__)
18+
1719

1820
@pytest.fixture(scope="module")
1921
def rabbit_config(docker_stack: Dict, devel_environ: Dict) -> Config:
@@ -127,7 +129,12 @@ async def rabbit_queue(
127129
# HELPERS --
128130

129131

130-
@tenacity.retry(**RabbitMQRetryPolicyUponInitialization().kwargs)
132+
@tenacity.retry(
133+
wait=tenacity.wait_fixed(5),
134+
stop=tenacity.stop_after_attempt(60),
135+
before_sleep=tenacity.before_sleep_log(log, logging.INFO),
136+
reraise=True,
137+
)
131138
async def wait_till_rabbit_responsive(url: str) -> None:
132139
connection = await aio_pika.connect(url)
133140
await connection.close()

services/catalog/docker-compose-extra.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ services:
4545
- REGISTRY_SSL=${REGISTRY_SSL}
4646
- DIRECTOR_REGISTRY_CACHING=${DIRECTOR_REGISTRY_CACHING}
4747
- DIRECTOR_REGISTRY_CACHING_TTL=${DIRECTOR_REGISTRY_CACHING_TTL}
48+
- DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS=${DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS}
4849
- DIRECTOR_SELF_SIGNED_SSL_SECRET_ID=${DIRECTOR_SELF_SIGNED_SSL_SECRET_ID}
4950
- DIRECTOR_SELF_SIGNED_SSL_SECRET_NAME=${DIRECTOR_SELF_SIGNED_SSL_SECRET_NAME}
5051
- DIRECTOR_SELF_SIGNED_SSL_FILENAME=${DIRECTOR_SELF_SIGNED_SSL_FILENAME}

services/director/src/simcore_service_director/config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
LOGLEVEL_STR = os.environ.get("LOGLEVEL", "WARNING").upper()
1212
log_level = getattr(logging, LOGLEVEL_STR)
1313
logging.basicConfig(
14-
level=log_level, format="%(levelname)s:%(name)s-%(lineno)d: %(message)s",
14+
level=log_level,
15+
format="%(levelname)s:%(name)s-%(lineno)d: %(message)s",
1516
)
1617
logging.root.setLevel(log_level)
1718

@@ -38,6 +39,10 @@
3839
os.environ.get("DIRECTOR_REGISTRY_CACHING_TTL", 15 * 60)
3940
)
4041

42+
DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS: str = os.environ.get(
43+
"DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS", ""
44+
)
45+
4146
# for passing self-signed certificate to spawned services
4247
DIRECTOR_SELF_SIGNED_SSL_SECRET_ID: str = os.environ.get(
4348
"DIRECTOR_SELF_SIGNED_SSL_SECRET_ID", ""

0 commit comments

Comments
 (0)