1. 28 May, 2020 8 commits
    • Steve Azzopardi's avatar
      Set process group for commander commands · fdf2fc43
      Steve Azzopardi authored
      Have the commander create a process group for every command it starts.
      This is so that each subprocess has the PPID set to the process that the
      custom executor start which will help with process termination. More
      information about process groups can be found in
      http://www.informit.com/articles/article.aspx?p=397655&seqNum=6.
      
      Update the unix killer to be aware of process groups and send the
      singal to each process instead of just the main process to prevent any
      orphan processes.
      
      This [program](https://gitlab.com/snippets/1930074) will spawn 10 child
      processes and all of them are attached to the Runner process since there
      is not process group set:
      
      ```plaintext
      $ ps -opid,pgid,command
      
      16934 16934 go run main.go run -c /Users/steve/Code/gitlab.com/gitlab-org/gitlab/gitlab-runner-config.toml                                                                                          <--- Runner process
      16962 16934 /var/folders/h4/45_ps9bn4jb6w51g1ngy_n5c0000gn/T/go-build263333944/b001/exe/main run -c /Users/steve/Code/gitlab.com/gitlab-org/gitlab/gitlab-runner-config.toml
      17164 16934 bash /Users/steve/Code/gitlab.com/custom-executor-drivers/debug/run.sh /var/folders/h4/45_ps9bn4jb6w51g1ngy_n5c0000gn/T/custom-executor808275188/script062524327/script. build_script   <--- run.sh still belongs to runner process group
      17165 16934 /bin/bash /var/folders/h4/45_ps9bn4jb6w51g1ngy_n5c0000gn/T/custom-executor808275188/script062524327/script.
      17167 16934 /bin/bash /var/folders/h4/45_ps9bn4jb6w51g1ngy_n5c0000gn/T/custom-executor808275188/script062524327/script.
      17168 16934 /Users/steve/Code/gitlab.com/steveazz/siglistener/siglistener
      17169 16934 sleep 60
      17170 16934 sleep 60
      17171 16934 sleep 60
      17172 16934 sleep 60
      17173 16934 sleep 60
      17174 16934 sleep 60
      17175 16934 sleep 60
      17176 16934 sleep 60
      17177 16934 sleep 60
      17178 16934 sleep 60
      ```
      
      With this commit we start getting what we see below. Notice how the pgid
      of the child process `sleep` are now for the `prepare_script` instead of
      the Runner process.
      
      ```plaintext
      $ ps -opid,pgid,command
      
      66515 66515 go run main.go run -c /Users/steve/Code/gitlab.com/gitlab-org/gitlab/gitlab-runner-config.toml                                                                                          <--- Runner process
      66991 66515 /var/folders/h4/45_ps9bn4jb6w51g1ngy_n5c0000gn/T/go-build545902909/b001/exe/main run -c /Users/steve/Code/gitlab.com/gitlab-org/gitlab/gitlab-runner-config.toml
      67086 67086 bash /Users/steve/Code/gitlab.com/custom-executor-drivers/debug/run.sh /var/folders/h4/45_ps9bn4jb6w51g1ngy_n5c0000gn/T/custom-executor612101401/script079237912/script. build_script   <--- run.sh set as progress group
      67087 67086 /bin/bash /var/folders/h4/45_ps9bn4jb6w51g1ngy_n5c0000gn/T/custom-executor612101401/script079237912/script.
      67089 67086 /bin/bash /var/folders/h4/45_ps9bn4jb6w51g1ngy_n5c0000gn/T/custom-executor612101401/script079237912/script.
      67090 67086 /Users/steve/Code/gitlab.com/steveazz/siglistener/siglistener
      67091 67086 (sleep)
      67092 67086 (sleep)
      67093 67086 (sleep)
      67094 67086 (sleep)
      67095 67086 (sleep)
      67096 67086 (sleep)
      67097 67086 (sleep)
      67098 67086 (sleep)
      67099 67086 (sleep)
      67100 67086 (sleep)
      ```
      
      More information about this testing can be found in
      !1743/#how-to-test
      
      This follows the model of the Shell executor and is explained in detail
      in
      https://medium.com/@felixge/killing-a-child-process-and-all-of-its-children-in-go-54079af94773
      why it's needed.
      
      reference #3376
      reference #4438
      fdf2fc43
    • Steve Azzopardi's avatar
      Move commander interface to helpers/process · f2c18b96
      Steve Azzopardi authored
      Extract `Commander` interface and the os implementation to the
      `helpers/process` package so that we can re-use it to the shell
      executor.
      
      The main goal of the MR is not to refactor anything from the Commander
      interface and CreateOptions, but simply extract it from 1 package to
      another.
      
      reference #3376
      reference #4438
      f2c18b96
    • Tomasz Maczukin's avatar
      Merge branch 'extract-process-killing-from-custom-executor' into 'master' · abc81f67
      Tomasz Maczukin authored
      Extract process killing from custom executor
      
      See merge request !1653
      abc81f67
    • Steve Azzopardi's avatar
      Merge branch... · f8f75c7a
      Steve Azzopardi authored
      Merge branch '25767-error-generating-trap-shell-script-when-using-kubernetes-attach-strategy' into 'master'
      
      Fix error when using attach strategy and ErrSkipBuildStage is returned when generating script
      
      Closes #25767
      
      See merge request !2123
      f8f75c7a
    • Georgi N. Georgiev's avatar
      Don't set default value of executor shell in TestGenerateScripts. Better log... · 806d96e2
      Georgi N. Georgiev authored
      Don't set default value of executor shell in TestGenerateScripts. Better log for when error is unexpected type for TestGenerateScripts.
      806d96e2
    • Steve Azzopardi's avatar
      Merge branch '25873-explicit-docker-context' into 'master' · 106ee94b
      Steve Azzopardi authored
      Pass an explicit context path to docker build in `build_ci_image`
      
      Closes #25873
      
      See merge request !2133
      106ee94b
    • Marcel Amirault's avatar
      Merge branch 'eread/add-docker-to-capitalization-rules-docs' into 'master' · 8acb8d10
      Marcel Amirault authored
      Add Docker to capitalization rules
      
      See merge request !2146
      8acb8d10
    • Evan Read's avatar
      Add Docker to capitalization rules · 07a10a2e
      Evan Read authored
      Also adds other rules from main GitLab project.
      07a10a2e
  2. 27 May, 2020 5 commits
  3. 26 May, 2020 5 commits
  4. 25 May, 2020 4 commits
  5. 22 May, 2020 5 commits
  6. 21 May, 2020 4 commits
  7. 20 May, 2020 8 commits
  8. 19 May, 2020 1 commit