@@ -227,40 +227,71 @@ jobs:
227227 tls : [openssl, rustls]
228228 steps :
229229 - uses : actions/checkout@v6
230- - uses : actions/cache@v4
230+
231+ - name : Setup Docker buildx
232+ id : setup-buildx
233+ uses : docker/setup-buildx-action@v3
234+
235+ # clux: i can never get the buildkit cache dance seems to work reliably so commenting it out
236+ # would like to get this to work long term, but at least the build is pretty fast
237+ # - uses: actions/cache@v4
238+ # id: cache
239+ # with:
240+ # path: |
241+ # target
242+ # .cargo/registry
243+ # .cargo/git
244+ # key: docker-cargo4-${{matrix.tls}}-${{ hashFiles('**/Cargo.toml', 'e2e/Dockerfile') }}
245+ # restore-keys: |
246+ # docker-cargo4-${{matrix.tls}}-
247+ - name : Create folders on cache miss (blank cache always atm)
248+ run : mkdir -p ~/.cargo/{git,registry} && mkdir -p target
249+
250+ # - name: Inject cache into docker
251+ # uses: reproducible-containers/buildkit-cache-dance@v3
252+ # with:
253+ # dockerfile: e2e/Dockerfile
254+ # builder: ${{ steps.setup-buildx.outputs.name }}
255+ # cache-map: |
256+ # {
257+ # "target": {
258+ # "target": "/app/target",
259+ # "id": "target"
260+ # },
261+ # ".cargo/registry": "/root/.cargo/registry",
262+ # ".cargo/git": "/root/.cargo/git"
263+ # }
264+ # skip-extraction: ${{ steps.cache.outputs.cache-hit }}
265+
266+ - name : Build and push Docker image
267+ id : build
268+ uses : docker/build-push-action@v6
231269 with :
232- path : |
233- ~/.cargo/registry/index
234- ~/.cargo/registry/cache
235- ~/.cargo/git
236- target
237- key : musl-cargo-${{ hashFiles('**/Cargo.toml') }}-${{matrix.tls}}
270+ context : .
271+ cache-from : type=gha
272+ cache-to : type=gha,mode=min
273+ platforms : linux/amd64
274+ push : false
275+ load : true
276+ file : e2e/Dockerfile
277+ tags : clux/kube-e2e:${{ github.sha }}
278+ build-args : |
279+ FEATURES=latest,${{matrix.tls}}
238280
239281 - uses : nolar/setup-k3d-k3s@v1
240282 with :
241283 version : latest
242- # k3d-kube
243284 k3d-name : kube
244285 # Used to avoid rate limits when fetching the releases from k3s repo.
245286 # Anonymous access is limited to 60 requests / hour / worker
246287 # github-token: ${{ secrets.GITHUB_TOKEN }}
247288 k3d-args : " --no-lb --no-rollback --k3s-arg --disable=traefik,servicelb,metrics-server@server:*"
248- - name : Compile e2e job against ${{matrix.tls}}
249- run : |
250- mkdir -p ~/.cargo/{git,registry}
251- docker run --rm -t \
252- --mount type=bind,source=${{ github.workspace }},target=/volume \
253- --mount type=bind,source=$HOME/.cargo/registry,target=/root/.cargo/registry \
254- --mount type=bind,source=$HOME/.cargo/git,target=/root/.cargo/git \
255- clux/muslrust:1.86.0-stable \
256- cargo build -p e2e --release --bin=job --features=latest,${{matrix.tls}} -v
257- cp target/x86_64-unknown-linux-musl/release/job e2e/
258-
259- - name : Build image
260- run : " docker build -t clux/kube-e2e:${{ github.sha }} e2e/"
261289 - name : Import image
262290 run : " k3d image import clux/kube-e2e:${{ github.sha }} --cluster kube"
263- - run : sed -i 's/latest/${{ github.sha }}/g' e2e/deployment.yaml
291+ - name : Template the yaml and verify we are testing what we built
292+ run : |
293+ sed -i 's/latest/${{ github.sha }}/g' e2e/deployment.yaml
294+ grep -q "${{ github.sha }}" e2e/deployment.yaml
264295
265296 - name : Create resource
266297 run : kubectl apply -f e2e/deployment.yaml -n apps
0 commit comments