diff --git a/.buddy/cd.yml b/.buddy/cd.yml new file mode 100644 index 0000000..3cb6386 --- /dev/null +++ b/.buddy/cd.yml @@ -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 \"ci@smartcar.com\"" + - "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" diff --git a/.buddy/ci.yml b/.buddy/ci.yml new file mode 100644 index 0000000..9de4bd1 --- /dev/null +++ b/.buddy/ci.yml @@ -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"