Skip to content

Commit

Permalink
feat: CI CD through buddy
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ashwinkumar committed Sep 4, 2024
1 parent 04ac3e3 commit 76d1af8
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .buddy/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
- pipeline: "CD"
events:
- type: "PUSH"
refs:
- "refs/heads/master"
fail_on_prepare_env_warning: true
actions:
- action: "Publish"
type: "BUILD"
docker_image_name: "library/openjdk"
docker_image_tag: "20"
execute_commands:
- "export ANDROID_HOME=\"/opt/android/sdk\""
- "export PATH=$PATH:/opt/android/sdk/cmdline-tools/tools/bin"
- "if [ ! -d \"$ANDROID_HOME/cmdline-tools\" ]; then"
- " curl -o sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip"
- " unzip sdk.zip"
- " rm sdk.zip"
- " mkdir \"$ANDROID_HOME/cmdline-tools\""
- " mv cmdline-tools \"$ANDROID_HOME/cmdline-tools/tools\""
- " yes | \"$ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager\" --licenses"
- "fi"
- ""
- "chmod +x gradlew"
- "export ORG_GRADLE_PROJECT_signingKey=\"$(cat /buddy-variables/cismartcar_com_pgp)\""
- "# Publish"
- ""
- "./gradlew publish closeAndReleaseStagingRepository"
- ""
- ""
setup_commands:
- "microdnf install unzip findutils"
cached_dirs:
- "/root/.gradle"
- "/opt/android/sdk"
shell: "BASH"
- action: "Send notification"
type: "SLACK"
content: "[#$BUDDY_EXECUTION_ID] $BUDDY_PIPELINE_NAME Successfully deployed <$BUDDY_PROJECT_URL|$BUDDY_PROJECT_NAME>"
blocks: "[\n\t{\n\t\t\"type\": \"section\",\n\t\t\"fields\": [\n\t\t\t{\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Successful run:* <$BUDDY_EXECUTION_URL|Execution #$BUDDY_EXECUTION_ID $BUDDY_EXECUTION_COMMENT>\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Pipeline:* <$BUDDY_PIPELINE_URL|$BUDDY_PIPELINE_NAME>\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Ref:* $BUDDY_PIPELINE_REF_NAME\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Project:* <$BUDDY_PROJECT_URL|$BUDDY_PROJECT_NAME>\"\n\t\t\t}\n\t\t]\n\t}\n]"
channel: "C047XPXG6"
integration: "L39J4q2Volej59vzdjNmGQBW71"
run_next: "IN_HARD_PARALLEL"
- action: "Push Git Tag"
type: "BUILD"
docker_image_name: "node"
docker_image_tag: "20"
execute_commands:
- "eval \"$(ssh-agent -s)\""
- "ssh-add ~/.ssh/smartcar_ci_travis_04_15_2021"
- "ssh-keyscan github.com >> /root/.ssh/known_hosts"
- "git config --global user.email \"[email protected]\""
- "git config --global user.name \"Buddy CI User\""
- ""
- "export SDK_VERSION=$(cat smartcar-auth/gradle.properties | grep -E '^libVersion=.*$' | sed 's/^libVersion=//')"
- "git config remote.$BUDDY_REPO_SLUG.url || git remote add $BUDDY_REPO_SLUG $BUDDY_REPO_SSH_URL.git"
- "git tag -af v$SDK_VERSION -m \"Buddy Generated Tag\""
- "git push $BUDDY_REPO_SLUG v$SDK_VERSION"
shell: "BASH"
- action: "Send notification-1"
type: "SLACK"
trigger_time: "ON_FAILURE"
content: "[#$BUDDY_EXECUTION_ID] $BUDDY_PIPELINE_NAME Failed to deploy <$BUDDY_PROJECT_URL|$BUDDY_PROJECT_NAME> to production."
blocks: "[\n\t{\n\t\t\"type\": \"section\",\n\t\t\"fields\": [\n\t\t\t{\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Failed run:* <$BUDDY_EXECUTION_URL|Execution #$BUDDY_EXECUTION_ID $BUDDY_EXECUTION_COMMENT>\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Pipeline:* <$BUDDY_PIPELINE_URL|$BUDDY_PIPELINE_NAME>\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Ref:* $BUDDY_PIPELINE_REF_NAME\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Project:* <$BUDDY_PROJECT_URL|$BUDDY_PROJECT_NAME>\"\n\t\t\t}\n\t\t]\n\t}\n]"
channel: "C0ERCSYEL"
integration: "L39J4q2Volej59vzdjNmGQBW71"
33 changes: 33 additions & 0 deletions .buddy/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- pipeline: "CI"
events:
- type: "PUSH"
refs:
- "refs/heads/*"
fail_on_prepare_env_warning: true
actions:
- action: "Build"
type: "BUILD"
docker_image_name: "library/openjdk"
docker_image_tag: "20"
execute_commands:
- "export ANDROID_HOME=\"/opt/android/sdk\""
- "export PATH=$PATH:/opt/android/sdk/cmdline-tools/tools/bin"
- "if [ ! -d \"$ANDROID_HOME/cmdline-tools\" ]; then"
- " curl -o sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip"
- " unzip sdk.zip"
- " rm sdk.zip"
- " mkdir \"$ANDROID_HOME/cmdline-tools\""
- " mv cmdline-tools \"$ANDROID_HOME/cmdline-tools/tools\""
- " yes | \"$ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager\" --licenses"
- "fi"
- ""
- "chmod +x gradlew"
- "./gradlew build check"
- "# ./gradlew assembleDebug"
- "# ./gradlew assembleRelease"
setup_commands:
- "microdnf install unzip findutils"
cached_dirs:
- "/root/.gradle"
- "/opt/android/sdk"
shell: "BASH"

0 comments on commit 76d1af8

Please sign in to comment.