#dagger-for-github not failing on dagger.ExecError

1 messages · Page 1 of 1 (latest)

timid nebula
nocturne grotto
native sage
#

@nocturne grotto I actually had that issue on one of our CI checks yesterday

#

Got an failed check from dagger cloud, but not from the corresponding gha job

nocturne grotto
timid nebula
#

I think in my case it was due to faulty async handling. I had a health check defined as:

def await_container_health(
    container: Container,
    url: str,
    retries: int = 60,
    interval: int = 1,
) -> Container:
    return container.with_exec(
        [
            "sh",
            "-c",
            f'''echo 'Waiting for service at {url} to be healthy...';
        for i in $(seq 1 {retries}); do
            if curl -s -f '{url}'; then
                echo '\n\nService is healthy!';
                exit 0;
            fi;
            sleep {interval};
        done;
        echo '\nService health check failed after {retries} attempts.';
        exit 1;
        ''',
        ]
    )

I changed it to:

async def await_container_health(
    container: Container,
    url: str,
    retries: int = 60,
    interval: int = 1,
) -> Container:
    health_check = container.with_exec(
        [
            "sh",
            "-c",
            f'''echo 'Waiting for service at {url} to be healthy...';
        for i in $(seq 1 {retries}); do
            if curl -s -f '{url}'; then
                echo '\n\nService is healthy!';
                exit 0;
            fi;
            sleep {interval};
        done;
        echo '\nService health check failed after {retries} attempts.';
        exit 1;
        ''',
        ]
    )
    # Explicitly sync to ensure errors propagate correctly
    await health_check.sync()
    return health_check

I'll report here if this does not fix it.