---
version: '3'

tasks:
  azure-cli:
    env:
      AZ_REPO:
        sh: lsb_release -cs
    cmds:
      - sudo apt-get update
      - sudo apt-get install -y --no-install-recommends ca-certificates curl apt-transport-https lsb-release gnupg
      - curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
      - echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
      - sudo apt-get update && sudo apt-get install -y --no-install-recommends azure-cli

  clean:
    log:
      error: Error encountered while cleaning apt-get caches
      start: Cleaning apt-get caches
      success: Finished cleaning apt-get caches
    cmds:
      - sudo apt-get autoremove -y
      - sudo apt-get clean -y
      - sudo rm -rf /var/lib/apt/lists/* /tmp/library-scripts/

  gcloud:
    cmds:
      - curl -sSL https://sdk.cloud.google.com | bash

  gitlab-runner:
    cmds:
      - curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
      - sudo apt-get update && sudo apt-get install -y --no-install-recommends gitlab-runner

  helm:
    cmds:
      - curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
      - sudo apt-get install apt-transport-https --yes
      - echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
      - sudo apt-get update && sudo apt-get install -y --no-install-recommends helm

  kubectl:
    cmds:
      - sudo apt-get update
      - sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates curl
      - sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
      - echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main"
        | sudo tee /etc/apt/sources.list.d/kubernetes.list
      - sudo apt-get update
      - sudo apt-get install -y --no-install-recommends kubectl

  node:
    cmds:
      - curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/node_setup.sh
      - sudo bash /tmp/node_setup.sh
      - rm /tmp/node_setup.sh
      - sudo apt-get update && sudo apt-get install -y --no-install-recommends nodejs

  packer:
    cmds:
      - curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
      - sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
      - sudo apt-get update && sudo apt-get install packer

  python:
    cmds:
      - sudo apt-get update
      - sudo apt-get install -y --no-install-recommends software-properties-common
      - sudo add-apt-repository -y ppa:deadsnakes/ppa
      - sudo apt-get update && sudo apt-get install -y --no-install-recommends python3.10 python3-pip

  sysbench:
    cmds:
      - curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.deb.sh | sudo bash
      - sudo apt-get update && sudo apt-get install -y --no-install-recommends sysbench

  terraform:
    cmds:
      - curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
      - sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
      - sudo apt-get update && sudo apt-get install -y --no-install-recommends terraform

  vagrant:
    cmds:
      - curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
      - sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
      - sudo apt-get update && sudo apt-get install vagrant

  waypoint:
    cmds:
      - curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
      - sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
      - sudo apt-get update && sudo apt-get install -y --no-install-recommends waypoint

  yarn:
    cmds:
      - curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
      - echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
      - sudo apt-get update && sudo apt-get install -y --no-install-recommends yarn
