Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

cache miss

Aperta
#200 8 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
docker, github-actions
Ambito
ci-cd, devops

Direzione di ricerca

Inizia con il passaggio docker/build-push-action del pre-build job e confronta le relative impostazioni cache-from/cache-to con il valore cacheFrom passato a devcontainers/[email protected]. Ispeziona i log di entrambe le chiamate a devcontainer e verifica che la prima chiamata riutilizzi l’immagine pubblicata o la cache invece di ricostruirla; il lavoro è completato quando la cache configurata viene utilizzata in modo coerente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hoping to get some guidance 🙏
In my workflow I have a separate job that builds a test image in CI off of a base production image using docker's build-push action. That image then gets pushed to GCR and subsequent steps pull to run tests. I'm noticing that for the first devcontainer action it'll rebuild the container from scratch everytime, even though the cache is being stored in line. looking at the docker build command shows
Screenshot 2023-02-02 at 4 35 33 PM

Could someone point out where my configuration may be incorrect?

Here is my workflow, (i've omitted some steps that I don't believe to be related to the issue):

jobs:
  pre-build:
    runs-on: ubuntu-latest

    outputs:
      run_attempt: ${{ github.run_attempt }}
      
    env:
      SHA: ${{ github.event.pull_request.head.sha }}

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Get Short GitHub SHA
        run: echo "SHA7=${SHA::7}" >> $GITHUB_ENV

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      
      - name: Log in to GCR
        uses: docker/login-action@v2
        with: 
          registry: gcr.io
          username: _json_key
          password: ${{ env.SERVICE_KEY_FILE }}

      - name: Build and Push Docker Image
        uses: docker/build-push-action@v3
        with:
          context: "{{defaultContext}}:dbt"
          pull: true
          push: true
          tags: |
            ${{ env.IMAGE_NAME }}:${{ env.DATASET }}.gh-${{ github.run_id }}.${{ github.run_attempt }}
            ${{ env.IMAGE_NAME }}:${{ env.SHA7 }}
          cache-from: type=gha
          cache-to: type=gha,mode=max,type=inline
          provenance: false
          secrets: |
            GIT_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}
  test:
    runs-on: ubuntu-latest
    needs: [ pre-build ]

    env:
      GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID_TEST }}
      TARGET: test
      
    steps:
      - name: Checkout
        uses: actions/checkout@v3     

      - name: Run git hooks
        uses: devcontainers/[email protected]
        env: 
          GOOGLE_APPLICATION_CREDENTIALS: /var/secrets/google/client_secrets.json
        with:
          cacheFrom: ${{ env.IMAGE_NAME }}:${{ env.DATASET }}.gh-${{ github.run_id }}.${{ github.run_attempt }}
          runCmd: |
              pre-commit run 

      - name: Run test
        uses: devcontainers/[email protected]
        env: 
          GOOGLE_APPLICATION_CREDENTIALS: /var/secrets/google/client_secrets.json
        with:
          cacheFrom: ${{ env.IMAGE_NAME }}:${{ env.DATASET }}.gh-${{ github.run_id }}.${{ github.run_attempt }}
          runCmd: |
              dbt test -m state:modified+ --defer --state .

The first devcontainer call:
Screenshot 2023-02-02 at 4 51 36 PM

The second devcontainer call:
Screenshot 2023-02-02 at 4 51 55 PM
it doesn't look like in the first instance of devcontainer the cache is being used?

The build and push step is successful:
Screenshot 2023-02-02 at 4 57 19 PM

Lingua principale
TypeScript
Stelle
499
Fork
101
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di devcontainers/ci

Tutte le issue di devcontainers/ci

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.