Skip to content

Commit 67f3e34

Browse files
author
Wiktor Maj
authored
Restore pipefail in Tests workflow to fail on non-zero exit codes (#161)
1 parent 4b52a3d commit 67f3e34

9 files changed

Lines changed: 39 additions & 11 deletions

File tree

.github/workflows/tests.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ jobs:
2222
/usr/local/share/boost \
2323
/usr/local/graalvm \
2424
/usr/local/share/chromium \
25-
/usr/local/share/powershell
26-
sudo docker image prune --all --force
25+
/usr/local/share/powershell \
26+
/usr/share/swift \
27+
/usr/local/share/vcpkg \
28+
/opt/hostedtoolcache
29+
sudo apt-get clean
30+
sudo docker system prune --all --volumes --force
31+
df -h
2732
2833
- uses: "actions/checkout@v4"
2934
- uses: "actions/setup-node@v3"
@@ -32,6 +37,7 @@ jobs:
3237
- uses: "hashicorp/setup-terraform@v3"
3338
with:
3439
terraform_version: "1.0.10"
40+
terraform_wrapper: false
3541
- uses: "actions/setup-python@v3"
3642
with:
3743
python-version: "3.10.12"
@@ -49,6 +55,7 @@ jobs:
4955

5056
- name: "Build and pre-load service images into test containers"
5157
run: |
58+
set -o pipefail
5259
build_and_load() {
5360
local image_name="$1"
5461
local build_context="$2"
@@ -71,6 +78,7 @@ jobs:
7178
7279
- name: "Run Ansible testsuite"
7380
run: |
81+
set -o pipefail
7482
ansible-playbook --inventory inventory.yml deploy.yml \
7583
2>&1 | tee -a /tmp/superset_cluster_testsuite.log
7684
working-directory: "${{ env.ANSIBLE_WORKING_DIRECTORY }}"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4444
* Made `create_directory()` idempotent to support deployment re-runs. (#35)
4545
* Added default inventory directive to `ansible.cfg`. (#42)
4646
* Fixed Publish workflow `write_package` permission denied by adding OCI source labels for GHCR repository linking. (#99)
47+
* Restore `pipefail` in Tests workflow to propagate non-zero exit codes through pipes. (#160)
4748

4849
## 1.0 - 2024-10-13
4950

services/mysql-server/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ RUN \
3939
mkdir \
4040
"/etc/mysql/ssl" \
4141
&& \
42+
mkdir \
43+
--parents \
44+
"/var/log/mysql" \
45+
&& \
46+
chown \
47+
mysql:mysql \
48+
"/var/log/mysql" \
49+
&& \
4250
apt-get \
4351
clean \
4452
&& \

services/superset/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN \
1919
install \
2020
--no-cache-dir \
2121
"redis==4.5.4" \
22-
"mysql-connector-python==9.0.0"
22+
"mysql-connector-python==8.4.0"
2323

2424
USER root
2525

services/superset/superset_config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@ class CeleryConfig: # pylint: disable=too-few-public-methods
4343

4444
CELERY_CONFIG = CeleryConfig # pylint: disable=invalid-name
4545
RESULTS_BACKEND = flask_caching.backends.rediscache.RedisCache(host="redis", port=6379, key_prefix="superset_results")
46+
47+
48+
def SQL_QUERY_MUTATOR(sql, **kwargs): # pylint: disable=invalid-name,unused-argument
49+
return sql
50+
51+
4652
SQL_MAX_ROW = 10000
4753
DEFAULT_SQLLAB_LIMIT = 1000
4854
SQLLAB_TIMEOUT = 300
4955
SQLLAB_VALIDATION_TIMEOUT = 60
5056
SQLLAB_DEFAULT_DBID = 1
51-
SQL_QUERY_MUTATOR = None
5257

5358
FILTER_STATE_CACHE_CONFIG = {
5459
"CACHE_TYPE": "RedisCache",

src/container.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,12 @@ def __init__(self, container: str | None) -> None:
103103
@staticmethod
104104
def pull_or_build_image(client: docker.client.DockerClient, image: str, build_context: str) -> None:
105105
try:
106-
client.images.pull(image)
107-
except (docker.errors.DockerException, requests.exceptions.RequestException):
108-
client.images.build(path=build_context, tag=image)
106+
client.images.get(image)
107+
except docker.errors.ImageNotFound:
108+
try:
109+
client.images.pull(image)
110+
except (docker.errors.DockerException, requests.exceptions.RequestException):
111+
client.images.build(path=build_context, tag=image)
109112

110113
def run_command_on_the_container(
111114
self,
@@ -440,9 +443,10 @@ def run(self) -> None:
440443
ContainerConnection.pull_or_build_image(
441444
self.client, image, "/opt/superset-cluster/superset"
442445
)
446+
image_id = self.client.images.get(image).id
443447
self.client.services.create(
444448
name="superset",
445-
image=image,
449+
image=image_id,
446450
networks=["superset-network"],
447451
secrets=[
448452
docker.types.SecretReference(

src/crypto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def generate_mysql_root_password() -> str:
6565

6666
@staticmethod
6767
def generate_mysql_superset_password() -> str:
68-
charset = string.ascii_letters + string.digits + string.punctuation
68+
charset = string.ascii_letters + string.digits
6969
return "".join(secrets.choice(charset) for _ in range(24))
7070

7171
@staticmethod

src/remote.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ def run_python_container_command(self, command: str) -> dict:
125125
) as memfile:
126126
source = memfile.read() + command
127127
self.upload_file(content=source, remote_file_path=f'/opt/{nonce}.py')
128-
_, stdout, stderr = self.ssh_client.exec_command(f"python3 /opt/{nonce}.py")
128+
_, stdout, stderr = self.ssh_client.exec_command(
129+
f"PYTHONPATH=/home/superset/.local/lib/python3.10/site-packages python3 /opt/{nonce}.py"
130+
)
129131
result = {
130132
"output": stdout.read().decode(),
131133
"error": stderr.read().decode()

tests/testsuite/roles/testing/tasks/system.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
async: 2100
1717
poll: 60
1818
register: "run_command"
19-
changed_when: "run_command.rc != 0"
19+
changed_when: false
2020

2121
- name: "Collect container health from each node"
2222
community.docker.docker_container_exec:

0 commit comments

Comments
 (0)