简体   繁体   English

从 Containerfile 执行构建时 redhat-actions/buildah-build@v2 失败

[英]redhat-actions/buildah-build@v2 failure while performing build from Containerfile

I'm trying to setup github workflow for building image and pushing it to the registry using redhat-actions actions:我正在尝试设置 github 工作流程以构建图像并使用redhat-actions操作将其推送到注册表:

workflow.yaml工作流.yaml

name: build-maven-runner
on:
  workflow_dispatch:
jobs:
  build-test-push:
    outputs:
      image-url: ${{ steps.push-to-artifactory.outputs.registry-path }}
      image-digest: ${{ steps.push-to-artifactory.outputs.digest }}
    name: build-job
    env:
      runner_memorylimit: 2Gi
      runner_cpulimit: 2
    runs-on: [ linux ]
    steps:
      - name: Clone
        uses: actions/checkout@v2

      - name: Pre-Login
        # podman-login: requires docker config repo auths
        # Error: TypeError: Cannot set property 'some.repo.com' of undefined
        mkdir /home/runner/.docker/
        cat <<EOT >> /home/runner/.docker/config.json
        {
          "auths": {
            "some.repo.com": {}
          }
        }
        EOT

      - name: Login
        uses: redhat-actions/podman-login@v1
        with:
          registry: some.repo.com
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          auth_file_path: /tmp/podman-run-1000/containers/auth.json

      - name: Build
        id: build-image
        uses: redhat-actions/buildah-build@v2
        with:
          image: some-image
          tags: latest
          containerfiles: ./config/Dockerfile
          tls-verify: false

      - name: Push
        id: push-to-artifactory
        uses: redhat-actions/push-to-registry@v2
        with:
          image: ${{ steps.build-image.outputs.image }}
          tags: latest
          registry: some.other.repo.com/project
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          tls-verify: false

./config/Dockerfile ./config/Docker文件

FROM .../openshift/origin-cli:4.10
USER root

RUN sudo yum update -y
RUN sudo yum install -y maven

RUN maven -version
RUN oc version

But Build step failing resulting in:但是Build步骤失败导致:

/usr/bin/buildah version
  Version:         1.22.3
  Go Version:      go1.15.2
  Image Spec:      1.0.1-dev
  Runtime Spec:    1.0.2-dev
  CNI Spec:        0.4.0
  libcni Version:  
  image Version:   5.15.2
  Git Commit:      
  Built:           Thu Jan  1 00:00:00 1970
  OS/Arch:         linux/amd64
Overriding storage mount_program with "fuse-overlayfs" in environment
Performing build from Containerfile
/usr/bin/buildah bud -f /runner/_work/some-project/some-project/config/Dockerfile --format docker --tls-verify=false -t some-image:latest /runner/_work/some-project/some-project
chown /home/runner/.local/share/containers/storage/overlay/l: operation not permitted
time="2022-12-12T16:13:52Z" level=warning msg="failed to shutdown storage: \"chown /home/runner/.local/share/containers/storage/overlay/l: operation not permitted\""
time="2022-12-12T16:13:52Z" level=error msg="exit status 125"
Error: Error: buildah exited with code 125

I'm fairly out of ideas at this point.. I was thinking if it has to do with storage.conf like mentioned here , but even overriding storage.conf still having same error.在这一点上我完全没有想法。我在想它是否与这里提到的 storage.conf 有关,但即使覆盖 storage.conf 仍然有同样的错误。 Originally this how storage.conf looks like:最初这是 storage.conf 的样子:

[storage]
driver = "overlay"
runroot = "/run/containers/storage"
graphroot = "/var/lib/containers/storage"

[storage.options]
additionalimagestores = [
]

[storage.options.overlay]
mountopt = "nodev,metacopy=on"

[storage.options.thinpool]

Does the problem lies deeper like in Dockerfile image ```openshif/origin-cli?问题是否像 Dockerfile 图像```openshif/origin-cli 中那样更深层次?

Any help would be appreciated任何帮助,将不胜感激

I ran into this issue today because I was doing some tests locally, typically your CICD should give the correct permissions to your containers (or the workers running your jobs).我今天遇到这个问题是因为我在本地做一些测试,通常你的 CICD 应该给你的容器(或运行你的工作的工作人员)正确的权限。 I fixed this issue by adding the --privileged flag while running my container, I do not recommend using that mode in production unless you are really sure what you are doing.我通过在运行我的容器时添加--privileged标志来解决这个问题,我不建议在生产中使用该模式,除非你真的确定你在做什么。 Perhaps not exactly your issue but dropping it here in case it helps someone else.也许不完全是你的问题,但把它放在这里以防它帮助别人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM