Skip to content

Set test build timeout to the DefaultTimeout value

Romuald Atchadé requested to merge k8s-set-build-timeout into main

What does this MR do?

Since the merge of !4361 (merged), the k8s integration tests are failing as the build has no timeout set and the pod get deleted as soon as it is available.

With this MR, the build timeout is set to the DefaultTimeout value to allow the tests to run successfully.

The change has been test locally with TestEntrypointNotIgnored integration test

test logs
❯ go test -timeout=60m -tags=integration,kubernetes -run TestEntrypointNotIgnored -v gitlab.com/gitlab-org/gitlab-runner/executors/kubernetes
=== RUN   TestEntrypointNotIgnored
=== RUN   TestEntrypointNotIgnored/build_image_with_entrypoint_feature_flag_off
    test.go:24: Running with gitlab-runner development version (HEAD)
        Preparing the "kubernetes" executor
        WARNING: Namespace is empty, therefore assuming 'default'.
        Using Kubernetes namespace: default
        Using Kubernetes executor with image registry.gitlab.com/gitlab-org/gitlab-runner/alpine-entrypoint:latest ...
        Using attach strategy to execute scripts...
        Preparing environment
        Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 2h0m0s...
        Waiting for pod default/runner--project-0-concurrent-0-pce6v8l4 to be running, status is Pending
        Running on runner--project-0-concurrent-0-pce6v8l4 via touni-mbp...
        
        Getting source from Git repository
        Fetching changes...
        Initialized empty Git repository in /builds/gitlab-org/ci-cd/gitlab-runner-pipeline-tests/gitlab-test/.git/
        Created fresh repository.
        Checking out 69b18e5e as detached HEAD (ref is main)...
        
        Skipping Git submodules setup
        
        Executing "step_script" stage of the job script
        $ if [ -f /tmp/debug.log ]; then
        $ echo 'file not found'
        file not found
        $ fi
        $ echo "I am now `whoami`"
        I am now root
        
        Job succeeded
        
    kubernetes_integration_test.go:336: Running with gitlab-runner development version (HEAD)
        Preparing the "kubernetes" executor
        WARNING: Namespace is empty, therefore assuming 'default'.
        Using Kubernetes namespace: default
        Using Kubernetes executor with image registry.gitlab.com/gitlab-org/gitlab-runner/alpine-entrypoint:latest ...
        Using attach strategy to execute scripts...
        Preparing environment
        Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 2h0m0s...
        Waiting for pod default/runner--project-0-concurrent-0-pce6v8l4 to be running, status is Pending
        Running on runner--project-0-concurrent-0-pce6v8l4 via touni-mbp...
        
        Getting source from Git repository
        Fetching changes...
        Initialized empty Git repository in /builds/gitlab-org/ci-cd/gitlab-runner-pipeline-tests/gitlab-test/.git/
        Created fresh repository.
        Checking out 69b18e5e as detached HEAD (ref is main)...
        
        Skipping Git submodules setup
        
        Executing "step_script" stage of the job script
        $ if [ -f /tmp/debug.log ]; then
        $ echo 'file not found'
        file not found
        $ fi
        $ echo "I am now `whoami`"
        I am now root
        
        Job succeeded
        
=== RUN   TestEntrypointNotIgnored/build_image_with_entrypoint_feature_flag_on
    test.go:24: Running with gitlab-runner development version (HEAD)
          feature flags: FF_KUBERNETES_HONOR_ENTRYPOINT:true
        Preparing the "kubernetes" executor
        WARNING: Namespace is empty, therefore assuming 'default'.
        Using Kubernetes namespace: default
        Using Kubernetes executor with image registry.gitlab.com/gitlab-org/gitlab-runner/alpine-entrypoint:latest ...
        Using attach strategy to execute scripts...
        Preparing environment
        Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 2h0m0s...
        Waiting for pod default/runner--project-0-concurrent-0-iq2l1dva to be running, status is Pending
        Running on runner--project-0-concurrent-0-iq2l1dva via touni-mbp...
        
        Getting source from Git repository
        Fetching changes...
        Initialized empty Git repository in /builds/gitlab-org/ci-cd/gitlab-runner-pipeline-tests/gitlab-test/.git/
        Created fresh repository.
        Checking out 69b18e5e as detached HEAD (ref is main)...
        
        Skipping Git submodules setup
        
        Executing "step_script" stage of the job script
        $ if [ -f /tmp/debug.log ]; then
        $ cat /tmp/debug.log
        this has been executed through a custom entrypoint
        $ else
        $ echo "I am now `whoami`"
        I am now nobody
        
        Job succeeded
        
    kubernetes_integration_test.go:336: Running with gitlab-runner development version (HEAD)
          feature flags: FF_KUBERNETES_HONOR_ENTRYPOINT:true
        Preparing the "kubernetes" executor
        WARNING: Namespace is empty, therefore assuming 'default'.
        Using Kubernetes namespace: default
        Using Kubernetes executor with image registry.gitlab.com/gitlab-org/gitlab-runner/alpine-entrypoint:latest ...
        Using attach strategy to execute scripts...
        Preparing environment
        Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 2h0m0s...
        Waiting for pod default/runner--project-0-concurrent-0-iq2l1dva to be running, status is Pending
        Running on runner--project-0-concurrent-0-iq2l1dva via touni-mbp...
        
        Getting source from Git repository
        Fetching changes...
        Initialized empty Git repository in /builds/gitlab-org/ci-cd/gitlab-runner-pipeline-tests/gitlab-test/.git/
        Created fresh repository.
        Checking out 69b18e5e as detached HEAD (ref is main)...
        
        Skipping Git submodules setup
        
        Executing "step_script" stage of the job script
        $ if [ -f /tmp/debug.log ]; then
        $ cat /tmp/debug.log
        this has been executed through a custom entrypoint
        $ else
        $ echo "I am now `whoami`"
        I am now nobody
        
        Job succeeded
        
=== RUN   TestEntrypointNotIgnored/helper_image_with_entrypoint_feature_flag_off
    test.go:24: Running with gitlab-runner development version (HEAD)
        Preparing the "kubernetes" executor
        WARNING: Namespace is empty, therefore assuming 'default'.
        Using Kubernetes namespace: default
        Using Kubernetes executor with image registry.gitlab.com/gitlab-org/gitlab-runner/alpine-entrypoint:latest ...
        Using attach strategy to execute scripts...
        Preparing environment
        Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 2h0m0s...
        Waiting for pod default/runner--project-0-concurrent-0-7ui5vh20 to be running, status is Pending
        Running on runner--project-0-concurrent-0-7ui5vh20 via touni-mbp...
        
        Getting source from Git repository
        Fetching changes...
        Initialized empty Git repository in /builds/gitlab-org/ci-cd/gitlab-runner-pipeline-tests/gitlab-test/.git/
        Created fresh repository.
        Checking out 69b18e5e as detached HEAD (ref is main)...
        
        Skipping Git submodules setup
        
        Executing "step_script" stage of the job script
        $ if [ -f /builds/debug.log ]; then
        $ echo 'file not found'
        file not found
        $ fi
        $ echo "I am now `whoami`"
        I am now root
        
        Job succeeded
        
    kubernetes_integration_test.go:336: Running with gitlab-runner development version (HEAD)
        Preparing the "kubernetes" executor
        WARNING: Namespace is empty, therefore assuming 'default'.
        Using Kubernetes namespace: default
        Using Kubernetes executor with image registry.gitlab.com/gitlab-org/gitlab-runner/alpine-entrypoint:latest ...
        Using attach strategy to execute scripts...
        Preparing environment
        Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 2h0m0s...
        Waiting for pod default/runner--project-0-concurrent-0-7ui5vh20 to be running, status is Pending
        Running on runner--project-0-concurrent-0-7ui5vh20 via touni-mbp...
        
        Getting source from Git repository
        Fetching changes...
        Initialized empty Git repository in /builds/gitlab-org/ci-cd/gitlab-runner-pipeline-tests/gitlab-test/.git/
        Created fresh repository.
        Checking out 69b18e5e as detached HEAD (ref is main)...
        
        Skipping Git submodules setup
        
        Executing "step_script" stage of the job script
        $ if [ -f /builds/debug.log ]; then
        $ echo 'file not found'
        file not found
        $ fi
        $ echo "I am now `whoami`"
        I am now root
        
        Job succeeded
        
=== RUN   TestEntrypointNotIgnored/helper_image_with_entrypoint_feature_flag_on
    test.go:24: Running with gitlab-runner development version (HEAD)
          feature flags: FF_KUBERNETES_HONOR_ENTRYPOINT:true
        Preparing the "kubernetes" executor
        WARNING: Namespace is empty, therefore assuming 'default'.
        Using Kubernetes namespace: default
        Using Kubernetes executor with image registry.gitlab.com/gitlab-org/gitlab-runner/alpine-entrypoint:latest ...
        Using attach strategy to execute scripts...
        Preparing environment
        Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 2h0m0s...
        Waiting for pod default/runner--project-0-concurrent-0-y5e881ag to be running, status is Pending
        Running on runner--project-0-concurrent-0-y5e881ag via touni-mbp...
        
        Getting source from Git repository
        Fetching changes...
        Initialized empty Git repository in /builds/gitlab-org/ci-cd/gitlab-runner-pipeline-tests/gitlab-test/.git/
        Created fresh repository.
        Checking out 69b18e5e as detached HEAD (ref is main)...
        
        Skipping Git submodules setup
        
        Executing "step_script" stage of the job script
        $ if [ -f /builds/debug.log ]; then
        $ cat /builds/debug.log
        this has been executed through a custom entrypoint
        $ else
        $ echo "I am now `whoami`"
        I am now nobody
        
        Job succeeded
        
    kubernetes_integration_test.go:336: Running with gitlab-runner development version (HEAD)
          feature flags: FF_KUBERNETES_HONOR_ENTRYPOINT:true
        Preparing the "kubernetes" executor
        WARNING: Namespace is empty, therefore assuming 'default'.
        Using Kubernetes namespace: default
        Using Kubernetes executor with image registry.gitlab.com/gitlab-org/gitlab-runner/alpine-entrypoint:latest ...
        Using attach strategy to execute scripts...
        Preparing environment
        Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 2h0m0s...
        Waiting for pod default/runner--project-0-concurrent-0-y5e881ag to be running, status is Pending
        Running on runner--project-0-concurrent-0-y5e881ag via touni-mbp...
        
        Getting source from Git repository
        Fetching changes...
        Initialized empty Git repository in /builds/gitlab-org/ci-cd/gitlab-runner-pipeline-tests/gitlab-test/.git/
        Created fresh repository.
        Checking out 69b18e5e as detached HEAD (ref is main)...
        
        Skipping Git submodules setup
        
        Executing "step_script" stage of the job script
        $ if [ -f /builds/debug.log ]; then
        $ cat /builds/debug.log
        this has been executed through a custom entrypoint
        $ else
        $ echo "I am now `whoami`"
        I am now nobody
        
        Job succeeded
        
--- PASS: TestEntrypointNotIgnored (31.57s)
    --- PASS: TestEntrypointNotIgnored/build_image_with_entrypoint_feature_flag_off (8.01s)
    --- PASS: TestEntrypointNotIgnored/build_image_with_entrypoint_feature_flag_on (7.75s)
    --- PASS: TestEntrypointNotIgnored/helper_image_with_entrypoint_feature_flag_off (7.84s)
    --- PASS: TestEntrypointNotIgnored/helper_image_with_entrypoint_feature_flag_on (7.79s)
PASS
ok      gitlab.com/gitlab-org/gitlab-runner/executors/kubernetes        32.166s

Why was this MR needed?

To fix failure in k8s integration tests

What's the best way to test this MR?

❯ go test -timeout=60m -tags=integration,kubernetes -run INTEGRATION_TEST_TO_RUN -v gitlab.com/gitlab-org/gitlab-runner/executors/kubernetes

What are the relevant issue numbers?

Edited by Romuald Atchadé

Merge request reports