Skip to content

Commit

Permalink
ci: remove buildx cache, bump versions (#1650)
Browse files Browse the repository at this point in the history
* ci: bump versions

* nit: command name

* bump win and macos

* bump ghr

* ci: test build & deploy

* ci: test unstable

* nit: buildx cache

* test: try without buildx cache

* ci: remove buildx caching

* ci: filter unstable
  • Loading branch information
jonaro00 committed Mar 5, 2024
1 parent 98551c9 commit f41afde
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 82 deletions.
107 changes: 31 additions & 76 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ orbs:
docker-buildx: sensu/docker-buildx@1.1.1
aws-ecr: circleci/aws-ecr@8.2.1
win: circleci/windows@5.0
macos: circleci/macos@2.3.6
macos: circleci/macos@2.4.1

executors:
docker-rust:
Expand Down Expand Up @@ -33,7 +33,7 @@ commands:
- run:
name: Install sccache
command: |
SCCACHE_VERSION='v0.5.4'
SCCACHE_VERSION='v0.7.7'
ls ~/.cargo/bin/sccache \
|| curl -L https://github.com/mozilla/sccache/releases/download/$SCCACHE_VERSION/sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl.tar.gz \
| tar -xOz sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl/sccache \
Expand Down Expand Up @@ -93,29 +93,6 @@ commands:
- ~/.cargo/registry/cache
- ~/.cargo/registry/index
- ~/.cargo/git/db
restore-buildx-cache:
steps:
- docker-buildx/install:
version: 0.8.2
qemu-user-static-version: 7.0.0-7
- restore_cache:
name: Restore buildx cache
keys:
# Try lock cache first
- docker-buildx-{{ checksum "Cargo.lock" }}
# Try branch cache next
- docker-buildx-{{ .Branch }}
- run:
name: Configure buildx cache
command: export BUILDX_CACHE=/tmp/cache/buildx
save-buildx-cache:
steps:
- save_cache:
name: Save buildx cache
paths:
- "/tmp/cache/buildx"
key: docker-buildx-{{ checksum "Cargo.lock" }}-{{ epoch }}
when: always
apply-patches:
steps:
- run:
Expand Down Expand Up @@ -159,12 +136,17 @@ commands:
- run:
name: Install cargo-audit
environment:
VERSION: "v0.18.3"
VERSION: "v0.20.0"
command: |
curl -L https://github.com/rustsec/rustsec/releases/download/cargo-audit/$VERSION/cargo-audit-x86_64-unknown-linux-musl-$VERSION.tgz \
| tar -xOz cargo-audit-x86_64-unknown-linux-musl-$VERSION/cargo-audit \
> ~/.cargo/bin/cargo-audit \
&& chmod +x ~/.cargo/bin/cargo-audit
set-git-tag:
steps:
- run:
name: Set git tag in BASH_ENV
command: echo TAG=$(git describe --tags --abbrev=0) >> $BASH_ENV
make-artifact:
parameters:
target:
Expand All @@ -175,10 +157,7 @@ commands:
type: string
default: ""
steps:
- run:
name: Set git tag in the environment
command: |
echo TAG=$(git describe --tags --abbrev=0) >> $BASH_ENV
- set-git-tag
- run:
name: Set binary directory in the environment
command: |
Expand Down Expand Up @@ -303,32 +282,17 @@ jobs:
- install-rust
- checkout
- run: git submodule update --init
- restore-buildx-cache
- run:
name: Make images for tests
command: |
sudo mkdir -p $BUILDX_CACHE && sudo chown -R circleci:circleci $BUILDX_CACHE
make images
- save-buildx-cache
- run: make images
- apply-patches
- run:
name: Run the E2E tests
command: |
# clean up a potential existing deployments before running
# the tests just in case the environment is not clean
make down
BUILDX_CACHE=/tmp/cache/buildx make up
make up
SHUTTLE_TESTS_NETWORK=shuttle-dev_user-net SHUTTLE_TESTS_RUNTIME_IMAGE=public.ecr.aws/shuttle-dev/deployer:latest cargo test --package shuttle-gateway --all-features --lib -- --nocapture
# runs tests in e2e crate
BUILDX_CACHE=/tmp/cache/buildx make test
- save_cache:
name: Save buildx cache
paths:
- /tmp/cache/buildx
key: docker-buildx-{{ .Branch }}-{{ .Revision }}
when: always
make test
build-and-push:
executor: machine-ubuntu
parameters:
Expand All @@ -348,23 +312,21 @@ jobs:
default: staging
steps:
- checkout
- run:
name: Set git tag in bash_env
command: |
echo TAG=$(git describe --tags --abbrev=0) >> $BASH_ENV
- restore-buildx-cache
- set-git-tag
- aws-ecr/ecr-login:
aws-access-key-id: << parameters.aws-access-key-id >>
aws-secret-access-key: << parameters.aws-secret-access-key >>
public-registry: << parameters.public-registry >>
# `registry-id`` field is required, although we don't need it (used for private registry).
# `registry-id` field is required, although we don't need it (used for private registry).
# We give it a non-empty env variable name to bypass the `ecr-login` empty check.
registry-id: TAG
registry-id: bruh
- docker-buildx/install:
version: 0.12.1
qemu-user-static-version: 7.2.0-1
- run:
name: Make and push images
command: |
PUSH=true SHUTTLE_SERVICE_VERSION=$TAG SHUTTLE_ENV=<< parameters.shuttle-env >> PLATFORMS=linux/amd64 TAG=$TAG make images
- save-buildx-cache
PUSH=true SHUTTLE_ENV=<< parameters.shuttle-env >> PLATFORMS=linux/amd64 TAG=$TAG SHUTTLE_SERVICE_VERSION=$TAG make images
deploy-images:
executor: machine-ubuntu
resource_class: medium
Expand Down Expand Up @@ -414,10 +376,7 @@ jobs:
type: string
steps:
- checkout
- run:
name: Set git tag in bash_env
command: |
echo TAG=$(git describe --tags --abbrev=0) >> $BASH_ENV
- set-git-tag
- add_ssh_keys:
fingerprints:
- << parameters.ssh-fingerprint >>
Expand Down Expand Up @@ -487,14 +446,13 @@ jobs:
target: << parameters.target >>
build-binaries-windows:
executor:
name: win/server-2022
name: win/default
size: xlarge
shell: bash.exe
environment:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- checkout
- run: choco install -y strawberryperl
- run:
name: Install Rust
# Note: Let binary build use latest
Expand All @@ -505,17 +463,14 @@ jobs:
- run:
name: Build
command: |
# From https://github.com/alexcrichton/openssl-src-rs/issues/45
# Because of https://github.com/openssl/openssl/issues/9048
$env:OPENSSL_SRC_PERL="C:\Strawberry\perl\bin\perl.exe"
..\.cargo\bin\cargo.exe build --release --package cargo-shuttle --target x86_64-pc-windows-msvc
shell: powershell.exe
- make-artifact:
target: x86_64-pc-windows-msvc
suffix: ".exe"
build-binaries-mac:
macos:
xcode: 14.2.0
xcode: 15.3.0
resource_class: macos.m1.medium.gen1
steps:
- checkout
Expand Down Expand Up @@ -550,7 +505,7 @@ jobs:
# the artifacts directory before passing it to ghr
command: |
find artifacts -mindepth 2 -type f -exec mv -t artifacts {} +
go install github.com/tcnksm/ghr@v0.16.0
go install github.com/tcnksm/ghr@v0.16.2
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -draft ${TAG} ./artifacts/
linux-qa:
machine:
Expand Down Expand Up @@ -581,8 +536,8 @@ jobs:
# command: ./.circleci/qa-docker.sh
mac-qa:
macos:
xcode: 12.5.1
resource_class: medium
xcode: 15.3.0
resource_class: macos.m1.medium.gen1
steps:
- checkout
- run:
Expand Down Expand Up @@ -645,7 +600,7 @@ jobs:
# - run:
# name: Test Docker
# command: ./.circleci/qa-docker.ps1
publish-crates:
publish-crate:
parameters:
path:
description: Path to crate to publish
Expand Down Expand Up @@ -900,7 +855,7 @@ workflows:
filters:
branches:
only: production
- publish-crates:
- publish-crate:
matrix:
parameters:
path:
Expand All @@ -909,7 +864,7 @@ workflows:
name: publish-<< matrix.path >>
requires:
- approve-publish-crates
- publish-crates:
- publish-crate:
matrix:
parameters:
path:
Expand All @@ -918,7 +873,7 @@ workflows:
name: publish-<< matrix.path >>
requires:
- publish-common
- publish-crates:
- publish-crate:
matrix:
parameters:
path:
Expand All @@ -933,7 +888,7 @@ workflows:
name: publish-<< matrix.path >>
requires:
- publish-service
- publish-crates:
- publish-crate:
matrix:
parameters:
path:
Expand All @@ -943,7 +898,7 @@ workflows:
requires:
- publish-service
- publish-proto
- publish-crates:
- publish-crate:
matrix:
parameters:
path:
Expand Down
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
COMMIT_SHA?=$(shell git rev-parse --short HEAD)

ifeq ($(CI),true)
BUILDX_CACHE?=/tmp/cache/buildx
CACHE_FLAGS=--cache-to type=local,dest=$(BUILDX_CACHE),mode=max --cache-from type=local,src=$(BUILDX_CACHE)
endif

ifeq ($(PUSH),true)
BUILDX_OP=--push
else
Expand All @@ -15,7 +10,7 @@ ifdef PLATFORMS
PLATFORM_FLAGS=--platform $(PLATFORMS)
endif

BUILDX_FLAGS=$(BUILDX_OP) $(PLATFORM_FLAGS) $(CACHE_FLAGS)
BUILDX_FLAGS=$(BUILDX_OP) $(PLATFORM_FLAGS)

# The Rust version used by our containers
# Can be updated to the latest stable
Expand Down

0 comments on commit f41afde

Please sign in to comment.