GitLab和gitlab-runner简略shell插件和sudo权限不足

原创
小哥 3年前 (2022-11-05) 阅读数 50 #大杂烩

stages:          # List of stages for jobs, and their order of execution

  • build
  • deploy

build-job:       # This job runs in the build stage, which runs first.
stage: build
tags:

  • specifictest
    script:
  • echo "Compiling the code..."
  • echo "Compile complete."

deploy-job:      # This job runs in the deploy stage.
stage: deploy  # It only runs when both jobs in the test stage complete successfully.
tags:

  • specifictest
    script:
  • echo "Deploying application..."
  • echo "Application successfully deployed."
  • cd /www/wwwroot/gitlabdemo
  • sudo /usr/local/git/bin/git pull origin main

/***/

stages:          # List of stages for jobs, and their order of execution

  • build
  • deploy

build-job:       # This job runs in the build stage, which runs first.
stage: build
tags:

  • specifictest
    script:
  • echo "Compiling the code..."
  • echo "Compile complete."

deploy-job:      # This job runs in the deploy stage.
stage: deploy  # It only runs when both jobs in the test stage complete successfully.
tags:

  • specifictest
    script:
  • echo "Deploying application..."
  • echo "Application successfully deployed."
  • cd /www/wwwroot/gitlabdemo
  • sudo /usr/local/git/bin/git pull origin main:main

sudo: 没有终端存在,且未指定 askpass 程序

vim /etc/sudoers
root ALL=(ALL) ALL
gitlab-runner ALL=(ALL) NOPASSWD:ALL
则shell将会执行成功。

版权声明

所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除

热门