Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

cache miss

Đang mở
#200 8 bình luận 3 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
docker, github-actions
Lĩnh vực
ci-cd, devops

Hướng nghiên cứu

Bắt đầu với bước docker/build-push-action của pre-build job và so sánh các thiết lập cache-from/cache-to của bước này với giá trị cacheFrom được truyền cho devcontainers/[email protected]. Kiểm tra log của cả hai lần gọi devcontainer và xác minh rằng lần gọi đầu tiên sử dụng lại image đã được push hoặc cache thay vì build lại image; hoàn tất khi cache đã cấu hình được sử dụng nhất quán.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
499
Fork
101
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của devcontainers/ci

Tất cả issue của devcontainers/ci

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.