miekg / pgo

container gitops in a simple way
GNU General Public License v3.0
11 stars 1 forks source link

gitlab environments #2

Closed miekg closed 1 year ago

miekg commented 1 year ago

Reading https://gitlab.science.ru.nl/help/ci/environments/index.md and playing with it, it seems to boil down on the URL that you can configure. If you put some kind of token in there and you can verify this on the pgo endpoint (same as with ssh ), ie. ?token=aaaa?name=xxxx?deploy

have to check what gitlab actually sends towards the endpoint, because how do you stop a deployment, vs starting it? Or should you toggle the state

miekg commented 1 year ago
stop_review:
  script:
    - ./teardown-environment
  when: manual
  environment:
    name: review/$CI_COMMIT_REF_SLUG
    action: stop

action: stop?

miekg commented 1 year ago

you can just set this up in a .gitlab-ci.yml

deploy_production:
  resource_group: production
  stage: deploy
  environment:
    name: production
    url: https://example.com
    on_stop: stop_production
  script:
    - echo hallo
  when: manual

stop_production:
  resource_group: production
  stage: deploy
  script:
    - echo "Delete the resources"
  environment:
    name: production
    action: stop
  when: manual

with script you can do with you want. So I propose we let pgoctl get a SSH key via the environment, and set up a variable in gitlab with an ssh pubkey as value, so you can also just use pgoctl from there. (need to make simple deb package out of it, but that's trivail)

miekg commented 1 year ago

btw URL give you live view of production, which may or may not be your website

miekg commented 1 year ago

documented in the README on how to do this