From 87e1749d4910f9c3cd113b074b8cd3608d3c0507 Mon Sep 17 00:00:00 2001 From: lars Date: Wed, 4 Oct 2023 15:29:08 -0500 Subject: [PATCH 1/6] Add Gitea workflow --- .gitea/workflows/DeployPR.yaml | 22 ++++++++++++++++++++++ .gitea/workflows/UndeployPR.yaml | 21 +++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 .gitea/workflows/DeployPR.yaml create mode 100644 .gitea/workflows/UndeployPR.yaml diff --git a/.gitea/workflows/DeployPR.yaml b/.gitea/workflows/DeployPR.yaml new file mode 100644 index 0000000..cb86e24 --- /dev/null +++ b/.gitea/workflows/DeployPR.yaml @@ -0,0 +1,22 @@ +name: Deploy PR +run-name: ${{ gitea.actor }} is deploying a PR +on: + pull_request: + types: [ opened, reopened ] + +jobs: + Deploy PR: + runs-on: ubuntu-latest + container: + image: python + steps: + - pip3 install requests python-dotenv --quiet + - python3 deploy/portainer/deploy.py + --PORTAINER https://dvportainer.privatedns.org + --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= + --PORTAINER_EP=CICD-runner + --GITEA_API_KEY=f449c74ec7f04e54fe1e481eae43492b34cea406 + --DEPLOY_REPO_URL=${DRONE_REPO_LINK} + --DEPLOY_BRANCH=${DRONE_SOURCE_BRANCH} + --DEPLOY_HOST=dvdemo.privatedns.org + \ No newline at end of file diff --git a/.gitea/workflows/UndeployPR.yaml b/.gitea/workflows/UndeployPR.yaml new file mode 100644 index 0000000..dfb109c --- /dev/null +++ b/.gitea/workflows/UndeployPR.yaml @@ -0,0 +1,21 @@ +name: Undeploy PR +run-name: ${{ gitea.actor }} is undeploying a PR +on: + pull_request: + types: [ closed ] + +jobs: + Deploy PR: + runs-on: ubuntu-latest + container: + image: python + steps: + - pip3 install requests python-dotenv --quiet + - python3 deploy/portainer/undeploy.py + --PORTAINER https://dvportainer.privatedns.org + --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= + --PORTAINER_EP=CICD-runner + --GITEA_API_KEY=f449c74ec7f04e54fe1e481eae43492b34cea406 + --DEPLOY_REPO_URL=${DRONE_REPO_LINK} + --DEPLOY_BRANCH=${DRONE_SOURCE_BRANCH} + \ No newline at end of file From b380440f5aac568626b6ff223dd83584f16c3240 Mon Sep 17 00:00:00 2001 From: lars Date: Wed, 4 Oct 2023 15:33:02 -0500 Subject: [PATCH 2/6] Fix steps syntax in workflow --- .gitea/workflows/DeployPR.yaml | 6 ++++-- .gitea/workflows/UndeployPR.yaml | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/DeployPR.yaml b/.gitea/workflows/DeployPR.yaml index cb86e24..0051002 100644 --- a/.gitea/workflows/DeployPR.yaml +++ b/.gitea/workflows/DeployPR.yaml @@ -10,8 +10,10 @@ jobs: container: image: python steps: - - pip3 install requests python-dotenv --quiet - - python3 deploy/portainer/deploy.py + - name: Install pip packages + run: pip3 install requests python-dotenv --quiet + - name: Run Deploy script + run: python3 deploy/portainer/deploy.py --PORTAINER https://dvportainer.privatedns.org --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= --PORTAINER_EP=CICD-runner diff --git a/.gitea/workflows/UndeployPR.yaml b/.gitea/workflows/UndeployPR.yaml index dfb109c..95d9dbc 100644 --- a/.gitea/workflows/UndeployPR.yaml +++ b/.gitea/workflows/UndeployPR.yaml @@ -10,8 +10,10 @@ jobs: container: image: python steps: - - pip3 install requests python-dotenv --quiet - - python3 deploy/portainer/undeploy.py + - name: Install pip packages + run: pip3 install requests python-dotenv --quiet + - name: Run Undeploy script + run: python3 deploy/portainer/undeploy.py --PORTAINER https://dvportainer.privatedns.org --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= --PORTAINER_EP=CICD-runner From 90dbbc1239516031891a7fa0190b7db407d7333e Mon Sep 17 00:00:00 2001 From: lars Date: Wed, 4 Oct 2023 15:35:58 -0500 Subject: [PATCH 3/6] Try multiline run block --- .gitea/workflows/DeployPR.yaml | 3 ++- .gitea/workflows/UndeployPR.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/DeployPR.yaml b/.gitea/workflows/DeployPR.yaml index 0051002..e364409 100644 --- a/.gitea/workflows/DeployPR.yaml +++ b/.gitea/workflows/DeployPR.yaml @@ -13,7 +13,8 @@ jobs: - name: Install pip packages run: pip3 install requests python-dotenv --quiet - name: Run Deploy script - run: python3 deploy/portainer/deploy.py + run: > + python3 deploy/portainer/deploy.py --PORTAINER https://dvportainer.privatedns.org --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= --PORTAINER_EP=CICD-runner diff --git a/.gitea/workflows/UndeployPR.yaml b/.gitea/workflows/UndeployPR.yaml index 95d9dbc..f17b457 100644 --- a/.gitea/workflows/UndeployPR.yaml +++ b/.gitea/workflows/UndeployPR.yaml @@ -13,7 +13,8 @@ jobs: - name: Install pip packages run: pip3 install requests python-dotenv --quiet - name: Run Undeploy script - run: python3 deploy/portainer/undeploy.py + run: > + python3 deploy/portainer/undeploy.py --PORTAINER https://dvportainer.privatedns.org --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= --PORTAINER_EP=CICD-runner From ffed04c8467f72a8d1c454ad95eb981e21211ede Mon Sep 17 00:00:00 2001 From: lars Date: Thu, 5 Oct 2023 00:56:03 +0000 Subject: [PATCH 4/6] Delete .drone.yml --- .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 ad99c05..0000000 --- a/.drone.yml +++ /dev/null @@ -1,53 +0,0 @@ -kind: pipeline -type: docker -name: deploy - -steps: - - name: Deploy to Portainer - image: alpine - commands: - - apk update - - apk add envsubst curl python3 - - python3 -m ensurepip - - pip3 install requests python-dotenv --quiet - - python3 deploy/portainer/deploy.py - --PORTAINER https://dvportainer.privatedns.org - --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= - --PORTAINER_EP=CICD-runner - --GITEA_API_KEY=f449c74ec7f04e54fe1e481eae43492b34cea406 - --DEPLOY_REPO_URL=${DRONE_REPO_LINK} - --DEPLOY_BRANCH=${DRONE_SOURCE_BRANCH} - --DEPLOY_HOST=dvdemo.privatedns.org - -trigger: - event: - - pull_request - action: - - opened - ---- -kind: pipeline -type: docker -name: undeploy - -steps: - - name: Undeploy from Portainer - image: alpine - commands: - - apk update - - apk add envsubst curl python3 - - python3 -m ensurepip - - pip3 install requests python-dotenv --quiet - - python3 deploy/portainer/undeploy.py - --PORTAINER https://dvportainer.privatedns.org - --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= - --PORTAINER_EP=CICD-runner - --GITEA_API_KEY=f449c74ec7f04e54fe1e481eae43492b34cea406 - --DEPLOY_REPO_URL=${DRONE_REPO_LINK} - --DEPLOY_BRANCH=${DRONE_COMMIT_BRANCH} - -trigger: - event: - - pull_request - action: - - closed \ No newline at end of file From cc61dba1a84aca1d1f6a023dc4f98cabe2daf7fb Mon Sep 17 00:00:00 2001 From: lars Date: Thu, 5 Oct 2023 00:58:47 +0000 Subject: [PATCH 5/6] Update .gitea/workflows/DeployPR.yaml --- .gitea/workflows/DeployPR.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/DeployPR.yaml b/.gitea/workflows/DeployPR.yaml index e364409..fa249d1 100644 --- a/.gitea/workflows/DeployPR.yaml +++ b/.gitea/workflows/DeployPR.yaml @@ -7,19 +7,19 @@ on: jobs: Deploy PR: runs-on: ubuntu-latest - container: - image: python steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 - name: Install pip packages run: pip3 install requests python-dotenv --quiet - name: Run Deploy script run: > - python3 deploy/portainer/deploy.py - --PORTAINER https://dvportainer.privatedns.org - --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= - --PORTAINER_EP=CICD-runner - --GITEA_API_KEY=f449c74ec7f04e54fe1e481eae43492b34cea406 - --DEPLOY_REPO_URL=${DRONE_REPO_LINK} - --DEPLOY_BRANCH=${DRONE_SOURCE_BRANCH} - --DEPLOY_HOST=dvdemo.privatedns.org + python3 deploy/portainer/deploy.py + --PORTAINER https://dvportainer.privatedns.org + --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= + --PORTAINER_EP=CICD-runner + --GITEA_API_KEY=f449c74ec7f04e54fe1e481eae43492b34cea406 + --DEPLOY_REPO_URL=${DRONE_REPO_LINK} + --DEPLOY_BRANCH=${DRONE_SOURCE_BRANCH} + --DEPLOY_HOST=dvdemo.privatedns.org \ No newline at end of file From 00e89bdc64f5272aace33591d95ce977cfe59d04 Mon Sep 17 00:00:00 2001 From: lars Date: Thu, 5 Oct 2023 00:59:08 +0000 Subject: [PATCH 6/6] Update .gitea/workflows/UndeployPR.yaml --- .gitea/workflows/UndeployPR.yaml | 46 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/UndeployPR.yaml b/.gitea/workflows/UndeployPR.yaml index f17b457..f2ae71a 100644 --- a/.gitea/workflows/UndeployPR.yaml +++ b/.gitea/workflows/UndeployPR.yaml @@ -1,24 +1,24 @@ -name: Undeploy PR -run-name: ${{ gitea.actor }} is undeploying a PR -on: - pull_request: - types: [ closed ] - -jobs: - Deploy PR: - runs-on: ubuntu-latest - container: - image: python - steps: - - name: Install pip packages - run: pip3 install requests python-dotenv --quiet - - name: Run Undeploy script - run: > - python3 deploy/portainer/undeploy.py - --PORTAINER https://dvportainer.privatedns.org - --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= - --PORTAINER_EP=CICD-runner - --GITEA_API_KEY=f449c74ec7f04e54fe1e481eae43492b34cea406 - --DEPLOY_REPO_URL=${DRONE_REPO_LINK} - --DEPLOY_BRANCH=${DRONE_SOURCE_BRANCH} +name: Undeploy PR +run-name: ${{ gitea.actor }} is undeploying a PR +on: + pull_request: + types: [ closed ] + +jobs: + Deploy PR: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + - name: Install pip packages + run: pip3 install requests python-dotenv --quiet + - name: Run Undeploy script + run: > + python3 deploy/portainer/undeploy.py + --PORTAINER https://dvportainer.privatedns.org + --PORTAINER_API_KEY=ptr_RwxH2Cd+htdD2FoFiG46erT9beyvj9VoF3BrQPtDH3Q= + --PORTAINER_EP=CICD-runner + --GITEA_API_KEY=f449c74ec7f04e54fe1e481eae43492b34cea406 + --DEPLOY_REPO_URL=${DRONE_REPO_LINK} + --DEPLOY_BRANCH=${DRONE_SOURCE_BRANCH} \ No newline at end of file