From 2d00660c67f9bc7f02efe535a782eb5ef08ff31a Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Tue, 2 Jul 2024 15:37:59 +0200 Subject: [PATCH] [ci] feat: migrated to gitea actions workflow --- .drone.yaml | 86 ------------------------------------- .gitea/workflows/build.yaml | 65 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 86 deletions(-) delete mode 100644 .drone.yaml create mode 100644 .gitea/workflows/build.yaml diff --git a/.drone.yaml b/.drone.yaml deleted file mode 100644 index fdf13a7..0000000 --- a/.drone.yaml +++ /dev/null @@ -1,86 +0,0 @@ ---- -kind: 'pipeline' -name: 'build' -type: 'kubernetes' - -steps: - -# build and publish -- image: 'docker.io/plugins/docker' - name: 'publish' - pull: 'always' - when: - branch: - - 'master' - event: - - 'push' - - settings: - - # registery and repos - registry: 'cr.simoncor.net' - repo: 'cr.simoncor.net/siempie/start-simoncor-net' - mtu: '1440' - - # build stuff - dockerfile: 'Dockerfile.linux.amd64' - daemon_off: 'false' - - # authentication - username: - from_secret: 'docker_username' - password: - from_secret: 'docker_password' - - # tags - tags: - - 'v1.1' - - 'latest' - - -# kubernetes deployment ---- -kind: 'pipeline' -name: 'deployment' -type: 'kubernetes' - -depends_on: - - 'build' - -# disable clone -clone: - disable: true - -# deployment step -steps: - - # kubernetes deployment - - name: 'kubernetes deployment' - image: 'docker.io/appleboy/drone-ssh:1' - when: - branch: - - 'master' - event: - - 'push' - - settings: - - # bastion - proxy_host: 'siempie.com' - proxy_port: '22' - proxy_user: - from_secret: 'drone_user' - proxy_key: - from_secret: 'drone_ssh_key' - - # k9s - host: 'k9s.siempie.internal' - port: '22' - user: - from_secret: 'drone_user' - key: - from_secret: 'drone_ssh_key' - script: - - # kubernetes deployment - - 'kubectl -n start-simoncor-net rollout restart deployment start-simoncor-net' diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..66e4be5 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,65 @@ +--- + +# generic +name: 'Build and Publish' +on: + push: + branches: + - 'master' + +# jobs +jobs: + + # build container + build: + runs-on: 'ubuntu-latest' + steps: + + # checkout code + - name: 'Clone repo' + uses: 'actions/checkout@v2' + + # login to cr.simoncor.net + - name: 'Login to cr.simoncor.net' + uses: 'docker/login-action@v2' + with: + registry: 'cr.simoncor.net' + username: ${{ vars.REGISTER_USERNAME }} + password: ${{ vars.REGISTER_PASSWORD }} + + # build and publish container + - name: 'Build and Publish' + uses: 'docker/build-push-action@v3' + with: + context: '.' + file: 'Dockerfile.linux.amd64' + push: true + tags: | + cr.simoncor.net/siempie/start-simoncor-net:latest + + + # ansible deployment + deployment: + runs-on: 'ubuntu-latest' + steps: + + # name: Build + - name: 'Ansible deployment' + uses: 'appleboy/ssh-action@v1.0.3' + with: + + # bastion + proxy_host: 'siempie.com' + proxy_port: '22' + proxy_username: ${{ secrets.USERNAME }} + proxy_key: ${{ secrets.SSHKEY }} + + # ansible management + host: 'ansible.siempie.internal' + port: '22' + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSHKEY }} + + # command + script: | + sudo /usr/local/bin/ansible-playbook /etc/ansible/playbooks/production/start.yaml