Quellcode durchsuchen

Feature/deploy public env from branch (#1256)

* Add input param to branch deploy workflow.
public: yes/no
defualt: no

The param will be responsible for publically availability of a 
deployment.

* Remove passing the GITHUB_TOKEN secret to infra repo script. It's not needed.

* Add password input param to branch-deploy.yml
Ruslan Ibragimov vor 3 Jahren
Ursprung
Commit
9ee1a28c8b
2 geänderte Dateien mit 21 neuen und 5 gelöschten Zeilen
  1. 20 4
      .github/workflows/branch-deploy.yml
  2. 1 1
      .github/workflows/master.yaml

+ 20 - 4
.github/workflows/branch-deploy.yml

@@ -1,6 +1,15 @@
 name: DeployFromBranch
 name: DeployFromBranch
 on:
 on:
   workflow_dispatch:
   workflow_dispatch:
+    inputs:
+      public:
+          required: true
+          description: Will this environment be publicly available?
+          default: "no"
+      kafka-ui-password:
+        required: true
+        description: Password that will be used to login to branch env. If the env is not publicly accessible, this password will not be used.
+        default: ""
   pull_request:
   pull_request:
     types: ['labeled']
     types: ['labeled']
 jobs:
 jobs:
@@ -83,17 +92,24 @@ jobs:
         run: |
         run: |
           cd kafka-ui-infra/aws-infrastructure4eks/argocd/scripts
           cd kafka-ui-infra/aws-infrastructure4eks/argocd/scripts
           echo "Branch:${{ needs.build.outputs.tag }}"
           echo "Branch:${{ needs.build.outputs.tag }}"
-          ./kafka-ui-deployment-from-branch.sh ${{ needs.build.outputs.tag }} ${{ secrets.GITHUB_TOKEN }}
+          ./kafka-ui-deployment-from-branch.sh ${{ needs.build.outputs.tag }} ${{ github.event.inputs.public }} ${{ github.event.inputs.kafka-ui-password }}
           git config --global user.email "kafka-ui-infra@provectus.com"
           git config --global user.email "kafka-ui-infra@provectus.com"
           git config --global user.name "kafka-ui-infra"
           git config --global user.name "kafka-ui-infra"
           git add ../kafka-ui-from-branch/
           git add ../kafka-ui-from-branch/
           git commit -m "added env:${{ needs.build.outputs.deploy }}" && git push || true
           git commit -m "added env:${{ needs.build.outputs.deploy }}" && git push || true
-      - name: make comment with deployment link
+
+      - name: make comment with private deployment link
+        if: ${{ github.event.inputs.public == 'no' }}
         uses: peter-evans/create-or-update-comment@v1.4.5
         uses: peter-evans/create-or-update-comment@v1.4.5
         with:
         with:
           issue-number: ${{ github.event.pull_request.number }}
           issue-number: ${{ github.event.pull_request.number }}
           body: |
           body: |
             Custom deployment will be available at http://${{ needs.build.outputs.tag }}.internal.kafka-ui.provectus.io
             Custom deployment will be available at http://${{ needs.build.outputs.tag }}.internal.kafka-ui.provectus.io
 
 
-
-
+      - name: make comment with public deployment link
+        if: ${{ github.event.inputs.public == 'yes' }}
+        uses: peter-evans/create-or-update-comment@v1.4.5
+        with:
+          issue-number: ${{ github.event.pull_request.number }}
+          body: |
+            Custom deployment will be available at http://${{ needs.build.outputs.tag }}.kafka-ui.provectus.io

+ 1 - 1
.github/workflows/master.yaml

@@ -70,7 +70,7 @@ jobs:
           git clone https://kafka-ui-infra:${{ secrets.KAFKA_UI_INFRA_TOKEN }}@gitlab.provectus.com/provectus-internals/kafka-ui-infra.git --branch master
           git clone https://kafka-ui-infra:${{ secrets.KAFKA_UI_INFRA_TOKEN }}@gitlab.provectus.com/provectus-internals/kafka-ui-infra.git --branch master
           cd kafka-ui-infra/aws-infrastructure4eks/argocd/scripts
           cd kafka-ui-infra/aws-infrastructure4eks/argocd/scripts
           echo "Image digest is:${{ steps.docker_build_and_push.outputs.digest }}"
           echo "Image digest is:${{ steps.docker_build_and_push.outputs.digest }}"
-          ./kafka-ui-update-master-digest.sh ${{ steps.docker_build_and_push.outputs.digest }} ${{ secrets.GITHUB_TOKEN }}
+          ./kafka-ui-update-master-digest.sh ${{ steps.docker_build_and_push.outputs.digest }}
           git config --global user.email "kafka-ui-infra@provectus.com"
           git config --global user.email "kafka-ui-infra@provectus.com"
           git config --global user.name "kafka-ui-infra"
           git config --global user.name "kafka-ui-infra"
           git add ../kafka-ui/*
           git add ../kafka-ui/*