Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #440 from deriv-com/revert-436-sandeep/fix-ghworkflow
Browse files Browse the repository at this point in the history
Revert "chore: working on workflows to mitigate the issues"
  • Loading branch information
sandeep-deriv authored Apr 3, 2024
2 parents d104561 + 3f18045 commit 3d89541
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 50 deletions.
40 changes: 10 additions & 30 deletions .github/actions/build_and_push_docker_image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,51 +36,31 @@ runs:
echo "NAMESPACE=${{ inputs.K8S_NAMESPACE }}" >> "$GITHUB_ENV"
echo "KUBE_SERVER=${{ inputs.KUBE_SERVER }}" >> "$GITHUB_ENV"
echo "SERVICEACCOUNT_TOKEN=${{ inputs.SERVICEACCOUNT_TOKEN }}" >> "$GITHUB_ENV"
echo "DOCKERHUB_ORGANISATION=${{ inputs.DOCKERHUB_ORGANISATION }}" >> "$GITHUB_ENV"
echo "CA_CRT=${{ inputs.CA_CRT }}" >> "$GITHUB_ENV"
echo "APP_NAME=deriv-static-bot" >> "$GITHUB_ENV"
echo "APP_VERSION=${{ inputs.APP_VERSION }}" >> "$GITHUB_ENV"
shell: bash

- name: Build docker image 🐳
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }}
APP_VERSION: ${{ inputs.APP_VERSION }}
APP_NAME: deriv-static-bot
run: docker build -t $DOCKERHUB_ORGANISATION/$APP_NAME:$APP_VERSION -t $DOCKERHUB_ORGANISATION/${APP_NAME}:$GITHUB_REF_NAME .
run: docker build -t ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${APP_VERSION} -t ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${{ github.ref_name }} .
shell: bash

- name: Verify nginx image
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }}
APP_NAME: deriv-static-bot
run: |
set -e
docker run --rm $DOCKERHUB_ORGANISATION/$APP_NAME:GITHUB_REF_NAME nginx -t
docker run --rm ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${{ github.ref_name }} nginx -t
echo "docker image validated successfully"
shell: bash

- name: Pushing Image to docker hub 🐳
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }}
DOCKERHUB_PASSWORD: ${{ inputs.DOCKERHUB_PASSWORD }}
DOCKERHUB_USERNAME: ${{ inputs.DOCKERHUB_USERNAME }}
APP_VERSION: ${{ inputs.APP_VERSION }}
APP_NAME: deriv-static-bot
run: |
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
docker push $DOCKERHUB_ORGANISATION/$APP_NAME:$APP_VERSION
docker push $DOCKERHUB_ORGANISATION/$APP_NAME:$GITHUB_REF_NAME
echo ${{ inputs.DOCKERHUB_PASSWORD }}| docker login -u ${{ inputs.DOCKERHUB_USERNAME }} --password-stdin
docker push ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${APP_VERSION}
docker push ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${{ github.ref_name }}
shell: bash

- name: Deploy 🚀
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
CA_CRT: ${{ inputs.CA_CRT }}
APP_NAME: deriv-static-bot
run: |
git clone https://github.com/binary-com/devops-ci-scripts
cd devops-ci-scripts/k8s-build_tools
echo $CA_CRT | base64 --decode > ca.crt
export CA="ca.crt"
./release.sh $APP_NAME $GITHUB_REF_NAME
./release.sh ${APP_NAME} ${{ github.ref_name }}
shell: bash
31 changes: 15 additions & 16 deletions .github/actions/send_slack_notifications/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,22 @@ runs:
using: composite
steps:
- name: Send Slack Notification on Success
env:
RELEASE_TYPE: ${{ inputs.RELEASE_TYPE }}
VERSION: ${{ inputs.VERSION }}
SLACK_WEBHOOK_URL: ${{ inputs.SLACK_WEBHOOK_URL }}

if: inputs.status == 'success'
uses: 'deriv-com/shared-actions/.github/actions/send_slack_notification@master'
with:
SLACK_WEBHOOK_URL: $SLACK_WEBHOOK_URL
MESSAGE: "$RELEASE_TYPE Release succeeded for deriv bot with version $VERSION"
run: |
curl -X POST -H 'Content-type: application/json' \
--data '{
"text": "${{ inputs.RELEASE_TYPE }} Release succeeded for deriv bot with version ${{ inputs.VERSION }}"
}' \
${{ inputs.SLACK_WEBHOOK_URL }}
shell: bash

- name: Send Slack Notification on Failure
env:
RELEASE_TYPE: ${{ inputs.RELEASE_TYPE }}
VERSION: ${{ inputs.VERSION }}
SLACK_WEBHOOK_URL: ${{ inputs.SLACK_WEBHOOK_URL }}
if: inputs.status == 'failure'
uses: 'deriv-com/shared-actions/.github/actions/send_slack_notification@master'
with:
SLACK_WEBHOOK_URL: $SLACK_WEBHOOK_URL
MESSAGE: "$RELEASE_TYPE Release failed for deriv bot with version $VERSION"
run: |
curl -X POST -H 'Content-type: application/json' \
--data '{
"text": "${{ inputs.RELEASE_TYPE }} Release failed for deriv bot with version ${{ inputs.VERSION }}"
}' \
${{ inputs.SLACK_WEBHOOK_URL }}
shell: bash
5 changes: 1 addition & 4 deletions .github/actions/versioning/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ runs:
using: composite
steps:
- name: Set version
env:
RELEASE_TYPE: ${{ inputs.RELEASE_TYPE }}
GITHUB_RUN_NUMBER: ${{ github.run_number }}
run: |
current_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
version="$RELEASE_TYPE-GH_Run#:$GITHUB_RUN_NUMBER-Date:$current_date"
version="${{ inputs.RELEASE_TYPE }}-GH_Run#:${{ github.run_number }}-Date:$current_date"
echo "Setting version to: $version"
echo "VERSION=$version" >> $GITHUB_ENV
shell: bash

0 comments on commit 3d89541

Please sign in to comment.