diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index a30b7ff..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Build and deploy -on: - push: - branches: - - master -concurrency: deploy -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - # - name: Build and deploy - # env: - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # AWS_REGION: us-west-1 - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # run: tools/ci-ec2.bash diff --git a/tools/ci-bootstrap.bash b/tools/ci-bootstrap.bash deleted file mode 100755 index 65fbde2..0000000 --- a/tools/ci-bootstrap.bash +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -: ${AWS_ACCESS_KEY_ID} -: ${AWS_SECRET_ACCESS_KEY} -: ${DOCKER_REPO} -: ${S3_BUCKET} - -make image shell I=ci CMD="tools/ci-run.bash" NI=1 diff --git a/tools/ci-ec2.bash b/tools/ci-ec2.bash deleted file mode 100755 index fa54cbf..0000000 --- a/tools/ci-ec2.bash +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -remote_url="$(git remote get-url origin | sed -E 's|git@github\.com:|https://github.com/|')" -commit="$(git rev-parse HEAD)" - -echo >&2 "[ci-run.bash] Fetching build parameters from SSM." - -parameters="riju-ci-ami-id riju-docker-repo-host riju-public-docker-repo-host riju-s3-bucket-name" -resp="$(aws ssm get-parameters --names ${parameters})" - -read -r ami < <(jq '.Parameters[] | select(.Name == "riju-ci-ami-id").Value' -r <<< "${resp}") -read -r docker_repo < <(jq '.Parameters[] | select(.Name == "riju-docker-repo-host").Value' -r <<< "${resp}") -read -r public_docker_repo < <(jq '.Parameters[] | select(.Name == "riju-public-docker-repo-host").Value' -r <<< "${resp}") -read -r s3_bucket < <(jq '.Parameters[] | select(.Name == "riju-s3-bucket-name").Value' -r <<< "${resp}") - -echo >&2 "[ci-run.bash] Launching EC2 instance for CI job." - -ebs_config="DeviceName=/dev/sdh,Ebs={DeleteOnTermination=true,VolumeSize=128,VolumeType=gp3}" -instance_tags="ResourceType=instance,Tags=[{Key=Name,Value=Riju CI},{Key=BillingCategory,Value=Riju},{Key=BillingSubcategory,Value=Riju:EC2:CI}]" -ebs_tags="ResourceType=volume,Tags=[{Key=Name,Value=Riju CI},{Key=BillingCategory,Value=Riju},{Key=BillingSubcategory,Value=Riju:EBS:CI}]" - -resp="$(aws ec2 run-instances \ - --image-id "${ami}" \ - --instance-type t3.2xlarge \ - --security-groups riju-deploy \ - --iam-instance-profile Name=riju-deploy \ - --instance-initiated-shutdown-behavior terminate \ - --user-data file://tools/ci-user-data.bash \ - --tag-specifications "${instance_tags}" "${ebs_tags}" \ - --block-device-mappings "${ebs_config}")" - -instance_id="$(jq '.Instances[].InstanceId' -r <<< "${resp}")" - -echo >&2 "[ci-run.bash] Waiting for instance ${instance_id} to become ready." - -success= -for i in $(seq 1 15); do - sleep 2 - resp="$(aws ec2 describe-instance-status --instance-id "${instance_id}")" - status="$(jq '.InstanceStatuses[].InstanceState.Name' -r <<< "${resp}")" - status="${status:-unknown}" - case "${status}" in - pending|unknown) ;; - running) success=yes; break ;; - * ) exit 1 ;; - esac -done - -if [[ -z "${success}}" ]]; then - exit 124 -fi - -echo >&2 "[ci-run.bash] Waiting for SSH to come online." - -success= -for i in $(seq 1 15); do - if (yes || true) | timeout 5 mssh "ubuntu@${instance_id}" true 2>/dev/null; then - success=yes - break - elif (( $# == 124 )); then - exit 1 - fi - sleep 2 -done - -if [[ -z "${success}}" ]]; then - exit 124 -fi - -echo >&2 "[ci-run.bash] Running CI remotely using EC2 Instance Connect." - -mssh "ubuntu@${instance_id}" bash <&2 "[ci-run.bash] CI completed." diff --git a/tools/ci-run.bash b/tools/ci-run.bash deleted file mode 100755 index f1c3875..0000000 --- a/tools/ci-run.bash +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -make ecr -make env CMD="dep deploy:live --registry --publish --yes" Z=xz CI=1 TEST_PATIENCE=4 TEST_CONCURRENCY=1 diff --git a/tools/ci-user-data.bash b/tools/ci-user-data.bash deleted file mode 100755 index a0e8dbe..0000000 --- a/tools/ci-user-data.bash +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -if [[ -z "${NOHUP:-}" ]]; then - NOHUP=1 nohup "$0" "$@" & -fi - -while true; do - sleep 60 - # https://unix.stackexchange.com/a/92579 - if ! sudo netstat -tnpa | grep 'ESTABLISHED.*sshd'; then - sudo shutdown -h now - fi -done