Commit 6ae4b822 authored by Ruben ten Hove's avatar Ruben ten Hove
Browse files

feat: os maintenance

parent 38571bae
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
---
os:debian:update:
  stage: deploy
  script:
    - sudo apt-get update
    - sudo apt-mark hold gitlab-runner # We need this process to stay during the upgrade.
    - sudo apt-get full-upgrade -y
    - |
      if ! ping -c 1 1.1.1.1 &> /dev/null; then
        echo "Networking failed during upgrade. Restarting networking."
        sudo systemctl restart networking
      fi
    - sudo apt-get autopurge -y
    - sudo apt-get purge -y $(dpkg -l | grep '^rc' | awk '{print $2}') # Purge package previously only removed
    - sudo apt-get install --only-upgrade -y gitlab-runner & # We'll send this upgrade to the background, so it can finish by itself
  rules:
    - if: $CI_DISPOSABLE_ENVIRONMENT == null
+7 −0
Original line number Diff line number Diff line
---
system:reboot:
  stage: deploy
  script:
    - sudo reboot
  rules:
    - if: '$CI_DISPOSABLE_ENVIRONMENT == null && $REBOOT'

os/readme.md

0 → 100644
+12 −0
Original line number Diff line number Diff line
# OS jobs

These jobs are targeted at shell executors.

To get this up and running, start
[here](https://docs.gitlab.com/runner/install/linux-repository.html).

Be sure to use the `shell` executor when registering a runner.

Each job checks if `$CI_DISPOSABLE_ENVIRONMENT` is not set. See
[here](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) for
what that means.