From ad6709920969333842727d9a99c3c90cbdeca680 Mon Sep 17 00:00:00 2001 From: Noah Knegt Date: Tue, 16 Apr 2024 19:36:39 +0200 Subject: [PATCH 1/8] Add gitea ci actions Signed-off-by: Noah Knegt --- .gitea/workflows/lint.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .gitea/workflows/lint.yml diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml new file mode 100644 index 0000000..5030dce --- /dev/null +++ b/.gitea/workflows/lint.yml @@ -0,0 +1,17 @@ +--- +name: Linting +run-name: Linting ansible and yaml files +on: + pull_request: + +jobs: + yaml-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Lint with yaml-lint + uses: ibiqlik/action-yamllint@v3 + with: + config_file: .yamllint.yml -- 2.49.1 From e385064e226bc20ca92c1c6ab3a6e5de3129f76e Mon Sep 17 00:00:00 2001 From: Noah Knegt Date: Tue, 16 Apr 2024 19:46:35 +0200 Subject: [PATCH 2/8] Manually install yamllint into the action Signed-off-by: Noah Knegt --- .gitea/workflows/lint.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 5030dce..5f88691 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -11,6 +11,16 @@ jobs: - name: Checkout source code uses: actions/checkout@v4 + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install yaml-lint # As yamllint action is a composite it does not install yamllint itself + run: | + python -m pip install --upgrade pip + pip install yamllint + - name: Lint with yaml-lint uses: ibiqlik/action-yamllint@v3 with: -- 2.49.1 From d12feaef290832783fab560ad06ff193cd901854 Mon Sep 17 00:00:00 2001 From: Noah Knegt Date: Tue, 16 Apr 2024 19:49:07 +0200 Subject: [PATCH 3/8] Change paython version to any python 3 version Signed-off-by: Noah Knegt --- .gitea/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 5f88691..1b59006 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: - name: Setup python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.x" - name: Install yaml-lint # As yamllint action is a composite it does not install yamllint itself run: | -- 2.49.1 From 9a43e64ac44bf191db347383d96767451cb7dfbe Mon Sep 17 00:00:00 2001 From: Noah Knegt Date: Tue, 16 Apr 2024 19:49:59 +0200 Subject: [PATCH 4/8] Use exact python version Signed-off-by: Noah Knegt --- .gitea/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 1b59006..1d10268 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: - name: Setup python uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: "3.12.3" - name: Install yaml-lint # As yamllint action is a composite it does not install yamllint itself run: | -- 2.49.1 From b9f5e93f41f68bf84ea86b4434b9602624c31bea Mon Sep 17 00:00:00 2001 From: Noah Knegt Date: Tue, 16 Apr 2024 19:55:00 +0200 Subject: [PATCH 5/8] Install yamllint through apt Signed-off-by: Noah Knegt --- .gitea/workflows/lint.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 1d10268..d30b23b 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -11,15 +11,10 @@ jobs: - name: Checkout source code uses: actions/checkout@v4 - - name: Setup python - uses: actions/setup-python@v4 - with: - python-version: "3.12.3" - - name: Install yaml-lint # As yamllint action is a composite it does not install yamllint itself run: | - python -m pip install --upgrade pip - pip install yamllint + apt update + apt install -y --no-install-recommends yamllint - name: Lint with yaml-lint uses: ibiqlik/action-yamllint@v3 -- 2.49.1 From 5b3ae037e3cfc7b0df50734435c780d6bde11857 Mon Sep 17 00:00:00 2001 From: Noah Knegt Date: Tue, 16 Apr 2024 19:59:59 +0200 Subject: [PATCH 6/8] Add ansible linting steps Signed-off-by: Noah Knegt --- .gitea/workflows/lint.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index d30b23b..b9a3d2b 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -20,3 +20,12 @@ jobs: uses: ibiqlik/action-yamllint@v3 with: config_file: .yamllint.yml + + ansible-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Lint with ansible lint + uses: ansible/ansible-lint@v24 -- 2.49.1 From 0125c6630fa2faf614bfda53bb68a1c3529a61ea Mon Sep 17 00:00:00 2001 From: Noah Knegt Date: Tue, 16 Apr 2024 20:04:57 +0200 Subject: [PATCH 7/8] Run on custom ubuntu image Signed-off-by: Noah Knegt --- .gitea/workflows/lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index b9a3d2b..d113b7b 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -23,6 +23,8 @@ jobs: ansible-lint: runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest steps: - name: Checkout source code uses: actions/checkout@v4 -- 2.49.1 From eb3ee1e12f1fa7ef623be85188f978de896346a9 Mon Sep 17 00:00:00 2001 From: Noah Knegt Date: Tue, 16 Apr 2024 20:07:01 +0200 Subject: [PATCH 8/8] Remove drone ci Signed-off-by: Noah Knegt --- .drone.yml | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index d9a3322..0000000 --- a/.drone.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -kind: pipeline -type: docker -name: ansible - -steps: - - name: yaml lint - image: cytopia/yamllint:alpine - commands: - - yamllint -c .yamllint.yml . - - - name: ansible lint - image: cytopia/ansible-lint:alpine - commands: - - ansible-lint . - - - name: setup ssh key - image: cytopia/ansible:latest-infra - commands: - - mkdir -p /root/.ssh - - echo "$SSH_KEY" > /root/.ssh/id_ed25519 - - chmod 600 /root/.ssh/id_ed25519 - - ssh-keyscan -p 4422 vps.noahknegt.com > /root/.ssh/known_hosts - environment: - SSH_KEY: - from_secret: ssh_key - volumes: - - name: ssh_key - path: /root/.ssh - when: - event: - - push - branch: - - master - - - name: ansible apply - image: cytopia/ansible:latest-infra - commands: - - eval `ssh-agent -s` - - ssh-add /root/.ssh/id_ed25519 - - ansible-playbook -i inventory/hosts.yml site.yml - volumes: - - name: ssh_key - path: /root/.ssh - when: - event: - - push - branch: - - master - -volumes: - - name: ssh_key - temp: {} -- 2.49.1