gpt4 book ai didi

git - Docker 构建推送操作 "Not a valid object name";输出 repo 的所有分支和标签

转载 作者:行者123 更新时间:2023-12-05 04:30:32 29 4
gpt4 key购买 nike

在 GitHub Action Workflow 中运行我们的 docker build 时,docker/build-push-action@v2 不断输出以下错误。这是在我们的 Dockerfile 中运行任何命令之前:

Run docker/build-push-action@v2
with:
file: packages/api/Dockerfile
tags: us.gcr.io/org-blahblah-shared/project-api:v7.9914
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
load: false
no-cache: false
pull: false
github-token: ***
env:
MAJOR_VERSION: v7
DOCKER_REGISTRY: us.gcr.io
GCP_PROJECT_ID: org-blahblah-shared
TAG: v7.9914
Docker info
/usr/bin/docker buildx build --cache-from type=gha --cache-to type=gha,mode=max --file packages/api/Dockerfile --iidfile /tmp/docker-build-push-vytgyS/iidfile --secret id=GIT_AUTH_TOKEN,src=/tmp/docker-build-push-vytgyS/tmp-2350-NvWl1QbeU577 --tag us.gcr.io/org-blahblah-shared/project-api:v7.9914 --metadata-file /tmp/docker-build-push-vytgyS/metadata-file --push https://github.com/org/project.git#abc123
#1 [internal] load git source https://github.com/org/project.git#123abc
#1 0.176 hint: Using 'master' as the name for the initial branch. This default branch name
#1 0.176 hint: is subject to change. To configure the initial branch name to use in all
#1 0.176 hint: of your new repositories, which will suppress this warning, call:
#1 0.176 hint:
#1 0.176 hint: git config --global init.defaultBranch <name>
#1 0.176 hint:
#1 0.176 hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
#1 0.176 hint: 'development'. The just-created branch can be renamed via this command:
#1 0.176 hint:
#1 0.176 hint: git branch -m <name>
#1 0.177 Initialized empty Git repository in /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/1/fs/
#1 0.259 fatal: Not a valid object name 123abc^***commit***
#1 6.346 From https://github.com/org/project
#1 6.346 * [new branch] blah
#1 6.346 * [new branch] blah2
#1 6.347 * [new branch] ...
#1 6.363 * [new tag] v1
#1 6.363 * [new tag] v2
#1 6.363 * [new tag] ...

这输出了大约 3000 行无用的输出,并且似乎是一些错误配置。我该如何解决这个根本问题,或者至少让输出受到控制?

它似乎与 docker buildx build 命令的最后一部分有关:--push https://github.com/org/project.git#abc123,但这似乎不受我们任何配置的直接控制。

最佳答案

生成推送操作 runs in a "GitHub" context by default .至少,这意味着将您的存储库作为 pre-Dockerfile 命令的一部分进行 pull 。

您可以使用以下方法将其更改为"file"上下文:

      - name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: user/app:latest

由于我们之前将存储库作为 checkout 操作的一部分进行了删除,因此它是多余的。

关于git - Docker 构建推送操作 "Not a valid object name";输出 repo 的所有分支和标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72049008/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com