[ETR-2390] Add more logging to sigterm handling (#220) #78
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
paths: | |
- control-plane/** | |
- shared/** | |
- .github/workflows/deploy-control-plane-image-staging.yml | |
- scripts/start-cage.sh | |
- scripts/health-check.sh | |
branches: | |
- main | |
name: Deploy new control plane image | |
env: | |
LINUX_TARGET: x86_64-unknown-linux-musl | |
jobs: | |
last_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: "standard-cache" | |
- name: Test control plane | |
run: cargo test -p control-plane | |
get-release-semver: | |
needs: [last_test] | |
runs-on: ubuntu-latest | |
outputs: | |
semver: ${{ steps.get-version.outputs.semver }} | |
semver-sha: ${{ steps.get-version.outputs.semver-sha }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Parse semver from cargo.toml | |
id: get-version | |
run: | | |
SHA_SUFFIX=${GITHUB_SHA::6} | |
SEMVER=$(cargo metadata --no-deps | jq -r ".packages[] | select(.name == \"control-plane\") | .version") | |
echo "Full semver: ${SEMVER}, appending suffix: ${SHA_SUFFIX}" | |
echo "semver=${SEMVER}" >> $GITHUB_OUTPUT | |
echo "semver-sha=${SEMVER}-${SHA_SUFFIX}" >> $GITHUB_OUTPUT | |
deploy_control_plane_image_with_egress: | |
runs-on: ubuntu-latest | |
needs: [last_test, get-release-semver] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build control plane | |
uses: evervault/[email protected] | |
with: | |
cmd: cargo build -p control-plane --features enclave,network_egress --release --target ${{ env.LINUX_TARGET }} | |
env: | |
RUSTFLAGS: "--cfg staging" | |
- name: Move control-plane binary to root | |
run: cp ./target/${{ env.LINUX_TARGET }}/release/control-plane ./control-plane | |
- name: Configure Staging AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, and tag | |
id: build-image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: evervault/control-plane | |
IMAGE_TAG: ${{ github.sha }} | |
SEMVER: ${{ needs.get-release-semver.outputs.semver }} | |
run: | | |
docker build -f ./control-plane/Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:egress-enabled-$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:egress-enabled-$SEMVER --pull --no-cache . | |
- name: Push control plane image to Amazon ECR | |
id: push-control-plane | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: evervault/control-plane | |
IMAGE_TAG: ${{ github.sha }} | |
SEMVER: ${{ needs.get-release-semver.outputs.semver }} | |
run: | | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:egress-enabled-$IMAGE_TAG | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:egress-enabled-$SEMVER | |
deploy_control_plane_image_without_egress: | |
runs-on: ubuntu-latest | |
needs: [last_test, get-release-semver] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build control plane | |
uses: evervault/[email protected] | |
with: | |
cmd: cargo build -p control-plane --features enclave --release --target ${{ env.LINUX_TARGET }} | |
env: | |
RUSTFLAGS: "--cfg staging" | |
- name: Move control-plane binary to root | |
run: cp ./target/${{ env.LINUX_TARGET }}/release/control-plane ./control-plane | |
- name: Configure Staging AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, and tag | |
id: build-image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: evervault/control-plane | |
IMAGE_TAG: ${{ github.sha }} | |
SEMVER: ${{ needs.get-release-semver.outputs.semver }} | |
run: | | |
docker build -f ./control-plane/Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:egress-disabled-$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:egress-disabled-$SEMVER --pull --no-cache . | |
- name: Push control plane image to Amazon ECR | |
id: push-control-plane | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: evervault/control-plane | |
IMAGE_TAG: ${{ github.sha }} | |
SEMVER: ${{ needs.get-release-semver.outputs.semver }} | |
run: | | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:egress-disabled-$IMAGE_TAG | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:egress-disabled-$SEMVER |