Skip to content

Execute the script from the right container

Romuald Atchadé requested to merge k8s-hybrid-mode-save-file-only-on-build into main

What does this MR do?

With the !3751 (merged) we save the user script just before executing it in attach mode. All the script where saved on the build container. However with the issue #29587 (closed) I realized that some of the predefined scripts are executed from the helper container causing the job to fail as the script cannot be found.

In this MR, the bug is fixed. But tests will be added in the runner-incept to test all the CI stages with both FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY mode

Why was this MR needed?

To fix a priority1 bug and add more testings on the k8s executor side

What's the best way to test this MR?

Notes 1: Your project must contain a Dockerfile. Here is a project you can copy and cleanup

Notes 2: In this manual test both cache and artifacts are being tested

gitlab-ci
build:
  image:
    name: gcr.io/kaniko-project/executor:v1.9.1-debug
    entrypoint: [""]
  script:
    - ls -alF
    - |
      /kaniko/executor --no-push
      # mkdir -p /workspace
  artifacts:
    paths:
      - Dockerfile
  cache:
    paths:
      - Dockerfile
config.toml
concurrent = 1
check_interval = 0
log_level = "debug"
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = ""
  url = "https://gitlab.com/"
  id = 149
  token = "REDACTED"
  token_obtained_at = 2023-02-07T10:29:37Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "kubernetes"
  [runners.cache]
    Type = "s3"
    Shared = true
    MaxUploadedArchiveSize = 0
    [runners.cache.s3]
      ServerAddress = "s3.amazonaws.com"
      AccessKey = "REDACTED"
      SecretKey = "REDACTED"
      BucketName = "touni-test-bucket"
      BucketLocation = "us-east-1"
  [runners.kubernetes]
    host = ""
    bearer_token_overwrite_allowed = false
    image = "alpine:latest"
    namespace = ""
    namespace_overwrite_allowed = ""
    allowed_pull_policies = ["always", "if-not-present"]
    pull_policy = ["always", "if-not-present"]
    node_selector_overwrite_allowed = ""
    pod_labels_overwrite_allowed = ""
    service_account_overwrite_allowed = ""
    pod_annotations_overwrite_allowed = ""
    [runners.kubernetes.pod_annotations]
      job_name = "$CI_JOB_NAME"
    [runners.kubernetes.pod_security_context]
    [runners.kubernetes.volumes]
    [runners.kubernetes.dns_config]

Run a job, it should succeed with the artifact available

What are the relevant issue numbers?

close #29587 (closed) #29601 (closed)

Edited by Romuald Atchadé

Merge request reports