IlyaSemenov / gitlab-ci-git-push

Gitlab CI runner image that pushes to a remote Git repo (Dokku, Heroku, Deis, etc.)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use

chriscrosscutler opened this issue · comments

Do you have to use your image? Aka does it need a Docker runner to work or can you just use the script to get it to work?

I believe this repo is useless. You can set a GL_TOKEN enviromnent variable using a personal access token and do the same with the following before_script.sh:

if [[ -v "GL_TOKEN" || -v "GITLAB_TOKEN" ]]; then
  if [[ "${CI_PROJECT_URL}" =~ (([^/]*/){3}) ]]; then
    mkdir -p $HOME/.config/git
    echo "${BASH_REMATCH[1]/:\/\//://gitlab-ci-token:${GL_TOKEN:-$GITLAB_TOKEN}@}" > $HOME/.config/git/credentials
    git config --global credential.helper store
  fi
fi

This will give you full access to the repo, only if the project is configured with a GL_TOKEN.

Also, it doesn't require to change the strategy at all, so it will use the CI token if the branch is non protected and your token if the branch is protected.

@chriscrosscutler:

Do you have to use your image?

No, you don't. If you don't need it, just don't use it. Simple as that.

Aka does it need a Docker runner to work or can you just use the script to get it to work?

This is up to you. The suggested use is documented in How to use chapter. I never tried to run it without Docker runner as I never needed it. After all it's a very simple image that just fits my needs.

You may just grab the script and use it. It was not made to be reusable outside of Docker runner so YMMV with that. Perhaps it's simpler to create it from scratch, it's just a few lines of code after all.

@kopax:

This will give you full access to the repo, only if the project is configured with a GL_TOKEN.

Did you even read the project description? Let me cite it for you:

This GitLab CI runner image allows to deploy a GitLab project to a remote Git repo (useful for Dokku, Heroku, Deis, etc.)

How in the world your token manipulations supposed to "give full access" to e.g. a remote Dokku instance? This is pure nonsense.

This repo is perhaps useless for your purposes. Which could be different from other people's purposes.

I am closing the discussion as non-constructive.