diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8bc8005c238..ae875dec8fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -397,7 +397,35 @@ jobs: notify_when: 'failure' env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_NOTIFY_BUILD }} + + # Deploy Fuel Core Ephemeral Developer Environment + deploy-eph-env: + if: github.ref == 'refs/heads/preview/*' + needs: + - publish-docker-image + runs-on: ubuntu-latest + steps: + - name: Set Environment Variables + run: | + tag=(`echo $GITHUB_SHA | cut -c1-7`) + echo "IMAGE_TAG=`echo sha-$tag`" >> $GITHUB_ENV + echo "DEPLOYMENT_VERSION=$(echo $GITHUB_SHA)" >> $GITHUB_ENV + echo "NAMESPACE=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV + - name: Deploy Fuel Core Ephemeral Developer Environment + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: Deploy Fuel-Core on k8s + repo: FuelLabs/fuel-deployment + ref: refs/heads/master + token: ${{ secrets.REPO_TOKEN }} + inputs: '{ "k8s-type": "${{ env.K8S }}", "config-directory": "${{ env.CONFIG }}", "config-env": "${{ env.ENV }}", "deployment-version": "${{ env.DEPLOYMENT_VERSION }}", "image-tag": "${{ env.IMAGE_TAG }}", "namespace": "${{ env.NAMESPACE }}", "delete-infra": "${{ env.DELETE_INFRA }}" }' + env: + K8S: 'eks' + CONFIG: 'fuel-dev1' + ENV: 'fueldevsway.env' + DELETE_INFRA: true + # Deploy Latest Fuel-Core Release deploy: if: github.ref == 'refs/heads/master' diff --git a/.github/workflows/delete-test-env.yml b/.github/workflows/delete-test-env.yml new file mode 100644 index 00000000000..949c594f74c --- /dev/null +++ b/.github/workflows/delete-test-env.yml @@ -0,0 +1,38 @@ +name: Delete Ephemeral Test Environment + +on: + pull_request: + types: [closed] + +env: + REGISTRY: ghcr.io + +jobs: + # Delete Ephemeral Test Environment + delete-test-enviromment: + if: github.ref == 'refs/heads/preview/*' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set Environment Variables + id: set_env_var + run: | + echo "NAMESPACE=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV + echo "DEPLOYMENT_VERSION=$(echo $GITHUB_SHA)" >> $GITHUB_ENV + + - name: Delete Ephemeral Test Environment + id: delete_eph_env + run: | + curl \ + -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.REPO_TOKEN }}" \ + https://api.github.com/repos/FuelLabs/fuel-deployment/actions/workflows/delete-test-env.yml/dispatches \ + -d '{"ref":"master","inputs":{ "k8s-type": "${{ env.K8S }}", "config-directory": "${{ env.CONFIG }}", "config-env": "${{ env.ENV }}", "deployment-version": "${{ env.DEPLOYMENT_VERSION }}", "namespace": "${{ env.NAMESPACE }}" }}' + env: + K8S: 'eks' + CONFIG: 'fuel-dev1' + ENV: 'fueldevsway.env' + diff --git a/.github/workflows/deploy-test-env.yml b/.github/workflows/deploy-test-env.yml new file mode 100644 index 00000000000..00bcd4580ba --- /dev/null +++ b/.github/workflows/deploy-test-env.yml @@ -0,0 +1,38 @@ +name: Deploy Ephemeral Test Environment + +on: + pull_request: + types: [opened, reopened] + +env: + REGISTRY: ghcr.io + +jobs: + # Deploy Fuel-Core Ephemeral Developer Environment + deploy-eph-enviromment: + if: github.ref == 'refs/heads/preview/*' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set Environment Variables + id: set_env_var + run: | + echo "DEPLOYMENT_VERSION=$(echo $GITHUB_SHA)" >> $GITHUB_ENV + echo "NAMESPACE=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV + + - name: Deploy Ephemeral Test Environment + id: deploy_eph_env + run: | + curl \ + -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.REPO_TOKEN }}" \ + https://api.github.com/repos/FuelLabs/fuel-deployment/actions/workflows/deploy-test-env.yml/dispatches \ + -d '{"ref":"master","inputs":{ "k8s-type": "${{ env.K8S }}", "config-directory": "${{ env.CONFIG }}", "config-env": "${{ env.ENV }}", "deployment-version": "${{ env.DEPLOYMENT_VERSION }}", "image-tag": "${{ env.IMAGE_TAG }}", "namespace": "${{ env.NAMESPACE }}" }}' + env: + K8S: 'eks' + CONFIG: 'fuel-dev1' + ENV: 'fueldevsway.env' + IMAGE_TAG: 'latest' diff --git a/deployment/scripts/fuel-core-deploy.sh b/deployment/scripts/fuel-core-deploy.sh index e6c4fdde2d8..2e3480616a9 100755 --- a/deployment/scripts/fuel-core-deploy.sh +++ b/deployment/scripts/fuel-core-deploy.sh @@ -23,10 +23,6 @@ if [ "${k8s_provider}" == "eks" ]; then --wait \ --timeout 8000s \ --debug - - # Verify Deployment - kubectl rollout status deployment/fuel-core-k8s --namespace ${k8s_namespace} --timeout=120s - else echo "You have inputted a non-supported kubernetes provider in your .env" fi