From 863fb6eb97bd2ffbfa3cc69e4966efe45766faef Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 16 Nov 2023 23:33:28 -0500 Subject: [PATCH 01/18] add branch development; test drone secret --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index 56ad312..7b242aa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,3 +10,4 @@ steps: - ansible-galaxy install -r $DRONE_WORKSPACE/requirements.yml - ansible-lint --offline $DRONE_WORKSPACE - ansible-playbook -v -i 127.0.0.1, $DRONE_WORKSPACE/hello.yml + - echo "GITEA_TOKEN=$GITEA_TOKEN" -- 2.47.1 From b53d9419bd14af8d4e62b08690919bf4dd733f75 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 16 Nov 2023 23:35:22 -0500 Subject: [PATCH 02/18] try again from docs --- .drone.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.drone.yml b/.drone.yml index 7b242aa..f307dcd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,6 +3,10 @@ name: Test Ansible Linting of drone-test-1 kind: pipeline type: docker +environment: + GITEA_TOKEN: + from_secret: GITEA_TOKEN + steps: - name: Testing Drone CI with a simple Ansible Playbook image: gitea.thezengarden.net/podman/images/ansible-dev:latest -- 2.47.1 From 546babeed2722fce99c77a38aa777e44f90abf05 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 16 Nov 2023 23:36:48 -0500 Subject: [PATCH 03/18] move environment --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index f307dcd..a043807 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,13 +3,13 @@ name: Test Ansible Linting of drone-test-1 kind: pipeline type: docker -environment: - GITEA_TOKEN: - from_secret: GITEA_TOKEN steps: - name: Testing Drone CI with a simple Ansible Playbook image: gitea.thezengarden.net/podman/images/ansible-dev:latest + environment: + GITEA_TOKEN: + from_secret: gitea_token commands: - ansible-galaxy install -r $DRONE_WORKSPACE/requirements.yml - ansible-lint --offline $DRONE_WORKSPACE -- 2.47.1 From c3a94b3046fdc4fc5783820fcd136bd0138961ca Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 16 Nov 2023 23:41:33 -0500 Subject: [PATCH 04/18] add new secret to test --- .drone.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index a043807..43b1f2d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,8 +10,13 @@ steps: environment: GITEA_TOKEN: from_secret: gitea_token + ANSIBLE_INVENTORY: + from_secret: ansible_inventory commands: - ansible-galaxy install -r $DRONE_WORKSPACE/requirements.yml - ansible-lint --offline $DRONE_WORKSPACE - - ansible-playbook -v -i 127.0.0.1, $DRONE_WORKSPACE/hello.yml + - ansible-playbook -v -i $ANSIBLE_INVENTORY $DRONE_WORKSPACE/hello.yml - echo "GITEA_TOKEN=$GITEA_TOKEN" + when: + branch: + - development -- 2.47.1 From aa126f91ee5f45a35f97490fc7ff1b438bd6b74f Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 16 Nov 2023 23:45:48 -0500 Subject: [PATCH 05/18] add giteacomment plugin lol --- .drone.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.drone.yml b/.drone.yml index 43b1f2d..a317ffa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,3 +20,14 @@ steps: when: branch: - development + + - name: post-to-gitea-pr-from-arg + image: tsakidev/giteacomment:latest + settings: + gitea_token: + from_secret: gitea_token + gitea_base_url: http://gitea.example.com + comment: "Hello from Drone" + when: + status: [ failure ] + event: pull_request -- 2.47.1 From b10d3b23c920d578070885c8b8e0d1696a95df81 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 16 Nov 2023 23:46:46 -0500 Subject: [PATCH 06/18] fix url --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index a317ffa..9568a98 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,8 +26,8 @@ steps: settings: gitea_token: from_secret: gitea_token - gitea_base_url: http://gitea.example.com + gitea_base_url: http://gitea.thezengarden.net comment: "Hello from Drone" when: - status: [ failure ] + # status: [ failure ] event: pull_request -- 2.47.1 From 0fe8cb51217fa52604927df5f1512f89b39bc31a Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 16 Nov 2023 23:58:23 -0500 Subject: [PATCH 07/18] add trigger --- .drone.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.drone.yml b/.drone.yml index 9568a98..5f1a180 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,6 +4,11 @@ kind: pipeline type: docker +trigger: + - pull_request + - push + + steps: - name: Testing Drone CI with a simple Ansible Playbook image: gitea.thezengarden.net/podman/images/ansible-dev:latest -- 2.47.1 From d39ca50802274987305f19a6d649c0ce2e7722e8 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:03:05 -0500 Subject: [PATCH 08/18] adding stuff --- .drone.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.drone.yml b/.drone.yml index 5f1a180..ef0c960 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,11 +4,6 @@ kind: pipeline type: docker -trigger: - - pull_request - - push - - steps: - name: Testing Drone CI with a simple Ansible Playbook image: gitea.thezengarden.net/podman/images/ansible-dev:latest @@ -26,13 +21,15 @@ steps: branch: - development - - name: post-to-gitea-pr-from-arg - image: tsakidev/giteacomment:latest - settings: - gitea_token: + - name: Can we post back to the PR + environment: + GITEA_TOKEN: from_secret: gitea_token - gitea_base_url: http://gitea.thezengarden.net - comment: "Hello from Drone" + commands: + - 'curl -sL -X POST -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-type: application/json" \ + https://gitea.thezengarden.net/api/v1/repos/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}/issues/${DRONE_PULL_REQUEST}/comments \ + -d "{\"body\": \"giraffe butt\"}"' when: - # status: [ failure ] - event: pull_request + event: + - pull_request -- 2.47.1 From 85c7e6e0f906dce763e3da4fbd2de657ff2bb217 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:03:59 -0500 Subject: [PATCH 09/18] fix - linter: invalid or missing image --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index ef0c960..10d98a8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -22,6 +22,7 @@ steps: - development - name: Can we post back to the PR + image: gitea.thezengarden.net/podman/images/ansible-dev:latest environment: GITEA_TOKEN: from_secret: gitea_token -- 2.47.1 From 425f0d878d804815f97fbf06102b96985ed1bebf Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:10:18 -0500 Subject: [PATCH 10/18] add build complete message to be sent back to the pr --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 10d98a8..61e6156 100644 --- a/.drone.yml +++ b/.drone.yml @@ -30,7 +30,7 @@ steps: - 'curl -sL -X POST -H "Authorization: token $GITEA_TOKEN" \ -H "Content-type: application/json" \ https://gitea.thezengarden.net/api/v1/repos/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}/issues/${DRONE_PULL_REQUEST}/comments \ - -d "{\"body\": \"giraffe butt\"}"' + -d "{\"body\": \"Build complete and successful for $DRONE_REPO_NAME\"}"' when: event: - pull_request -- 2.47.1 From 0e73abc19d15d6b3ac7f93a50fa36ae00578b208 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:17:28 -0500 Subject: [PATCH 11/18] replace gitea token echo with a status complete message; also wanting to checkout drone ci vscode extension --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 61e6156..d5e8888 100644 --- a/.drone.yml +++ b/.drone.yml @@ -16,7 +16,7 @@ steps: - ansible-galaxy install -r $DRONE_WORKSPACE/requirements.yml - ansible-lint --offline $DRONE_WORKSPACE - ansible-playbook -v -i $ANSIBLE_INVENTORY $DRONE_WORKSPACE/hello.yml - - echo "GITEA_TOKEN=$GITEA_TOKEN" + - echo "Build complete and successful for $DRONE_REPO_NAME" when: branch: - development -- 2.47.1 From 5bdb1a3e5657f56fc6ba77aeaa7dc5a2cec6329a Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:22:51 -0500 Subject: [PATCH 12/18] add depends_on; modify task name --- .drone.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index d5e8888..f226405 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,7 +21,7 @@ steps: branch: - development - - name: Can we post back to the PR + - name: Add comment to pull request image: gitea.thezengarden.net/podman/images/ansible-dev:latest environment: GITEA_TOKEN: @@ -31,6 +31,8 @@ steps: -H "Content-type: application/json" \ https://gitea.thezengarden.net/api/v1/repos/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}/issues/${DRONE_PULL_REQUEST}/comments \ -d "{\"body\": \"Build complete and successful for $DRONE_REPO_NAME\"}"' + depends_on: + - "Testing Drone CI with a simple Ansible Playbook" when: event: - pull_request -- 2.47.1 From 013b9e8a2cc49cc7dea236b721a6a29a0d5c6e89 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:25:49 -0500 Subject: [PATCH 13/18] task name update...again! --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index f226405..48b7150 100644 --- a/.drone.yml +++ b/.drone.yml @@ -5,7 +5,7 @@ type: docker steps: - - name: Testing Drone CI with a simple Ansible Playbook + - name: Ansible Playbook Lint and Test Execution image: gitea.thezengarden.net/podman/images/ansible-dev:latest environment: GITEA_TOKEN: @@ -32,7 +32,7 @@ steps: https://gitea.thezengarden.net/api/v1/repos/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}/issues/${DRONE_PULL_REQUEST}/comments \ -d "{\"body\": \"Build complete and successful for $DRONE_REPO_NAME\"}"' depends_on: - - "Testing Drone CI with a simple Ansible Playbook" + - "Ansible Playbook Lint and Test Execution" when: event: - pull_request -- 2.47.1 From 2b442f6a958a234b4dbe448e444c2805a0138b6b Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:28:33 -0500 Subject: [PATCH 14/18] changing up the order of the guard --- .drone.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index 48b7150..8b9908a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,11 +1,11 @@ --- -name: Test Ansible Linting of drone-test-1 +name: Ansible Playbook Lint and Test Execution kind: pipeline type: docker steps: - - name: Ansible Playbook Lint and Test Execution + - name: Install requirements, lint, and run Ansible playbook image: gitea.thezengarden.net/podman/images/ansible-dev:latest environment: GITEA_TOKEN: @@ -21,18 +21,21 @@ steps: branch: - development +--- +name: Test Ansible Linting of drone-test-1 +kind: pipeline +type: docker + +steps: - name: Add comment to pull request image: gitea.thezengarden.net/podman/images/ansible-dev:latest environment: GITEA_TOKEN: from_secret: gitea_token commands: - - 'curl -sL -X POST -H "Authorization: token $GITEA_TOKEN" \ - -H "Content-type: application/json" \ - https://gitea.thezengarden.net/api/v1/repos/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}/issues/${DRONE_PULL_REQUEST}/comments \ - -d "{\"body\": \"Build complete and successful for $DRONE_REPO_NAME\"}"' + - 'curl -sL -X POST -H "Authorization: token $GITEA_TOKEN" -H "Content-type: application/json" https://gitea.thezengarden.net/api/v1/repos/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}/issues/${DRONE_PULL_REQUEST}/comments -d "{\"body\": \"Build complete and successful for $DRONE_REPO_NAME\"}"' depends_on: - - "Ansible Playbook Lint and Test Execution" + - "Install requirements, lint, and run Ansible playbook" when: event: - pull_request -- 2.47.1 From 5a2932e47a6d8e43a2f9d188e05ab5c34851239e Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:41:59 -0500 Subject: [PATCH 15/18] comment pr section --- .drone.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.drone.yml b/.drone.yml index 8b9908a..7ae98de 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,21 +21,21 @@ steps: branch: - development ---- -name: Test Ansible Linting of drone-test-1 -kind: pipeline -type: docker +# --- +# name: Test Ansible Linting of drone-test-1 +# kind: pipeline +# type: docker -steps: - - name: Add comment to pull request - image: gitea.thezengarden.net/podman/images/ansible-dev:latest - environment: - GITEA_TOKEN: - from_secret: gitea_token - commands: - - 'curl -sL -X POST -H "Authorization: token $GITEA_TOKEN" -H "Content-type: application/json" https://gitea.thezengarden.net/api/v1/repos/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}/issues/${DRONE_PULL_REQUEST}/comments -d "{\"body\": \"Build complete and successful for $DRONE_REPO_NAME\"}"' - depends_on: - - "Install requirements, lint, and run Ansible playbook" - when: - event: - - pull_request +# steps: +# - name: Add comment to pull request +# image: gitea.thezengarden.net/podman/images/ansible-dev:latest +# environment: +# GITEA_TOKEN: +# from_secret: gitea_token +# commands: +# - 'curl -sL -X POST -H "Authorization: token $GITEA_TOKEN" -H "Content-type: application/json" https://gitea.thezengarden.net/api/v1/repos/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}/issues/${DRONE_PULL_REQUEST}/comments -d "{\"body\": \"Build complete and successful for $DRONE_REPO_NAME\"}"' +# depends_on: +# - "Install requirements, lint, and run Ansible playbook" +# when: +# event: +# - pull_request -- 2.47.1 From 5a491484cd7a300eecc679747b9faf594ce16a7f Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:43:15 -0500 Subject: [PATCH 16/18] add .ansible-lint --- .ansible-lint | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .ansible-lint diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..5719c8e --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,2 @@ +skip_list: + - yaml[line-length] -- 2.47.1 From f134699912f6cc8948293e0b064f1830643f2277 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:43:55 -0500 Subject: [PATCH 17/18] update .drone.yml --- .drone.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.drone.yml b/.drone.yml index 7ae98de..6017de2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,6 +20,8 @@ steps: when: branch: - development + event: + - push # --- # name: Test Ansible Linting of drone-test-1 -- 2.47.1 From fa1acea42a822dc6279a6bbf4cd890f98a369718 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 17 Nov 2023 00:45:27 -0500 Subject: [PATCH 18/18] anotrher update for inclusion and exclusion --- .drone.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 6017de2..9d5fbce 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,7 +21,10 @@ steps: branch: - development event: - - push + include: + - push + exclude: + - pull_request # --- # name: Test Ansible Linting of drone-test-1 -- 2.47.1