大厅资源 - 无法放置任务输出

时间:2017-05-31 11:54:25

标签: fedora-25 concourse

如何put output task成为资源?

  - name: build-pkg-rpm
    public: true
    plan:
    - aggregate:
      - get: oregano-test-fedora
      - get: git-clone-resource
        trigger: true
        passed: [compile, build-docker-image-fedora]

    - task: create-rpm
      image: oregano-test-fedora
      config:
        platform: linux
        inputs:
        - name: git-clone-resource
        outputs:
        - name: srpm
          path: ../srpm
        run:
          path: .concourse/fedora/buildrpm.sh
          dir: git-clone-resource

    - put: srpm
      resource: copr-resource
      params:
        rpmbuild_dir: "srpm/rpmbuild/SRPMS"
        chroots: ["mageia-6-x86_64", "mageia-couldron-x86_64", "fedora-rawhide-x86_64", "fedora-25-x86_64"]
        enable_net: false
        max_n_bytes: 250000000
        project_id: 825
        regex: ".*oregano-.*\\.src\\.rpm$"

buildrpm.sh

#!/usr/bin/env bash

set -e
set -x

pwd 2>&1
RPMBUILD_DIR="$(pwd)/../srpm/rpmbuild/"
mkdir -p ${RPMBUILD_DIR}/{SOURCES,BUILD,RPMS,SRPMS,SPECS}

# fill all vars of the spec.in
./waf configure rpmspec
cp -v build/rpmspec/oregano.spec ${RPMBUILD_DIR}/SPECS/

# generate the distributable tar
./waf dist
cp -v oregano*.tar.xz ${RPMBUILD_DIR}/SOURCES/

cd ${RPMBUILD_DIR}
rpmbuild \
--define "_topdir %(pwd)" \
--define "_builddir %{_topdir}/BUILD" \
--define "_rpmdir %{_topdir}/RPMS" \
--define "_srcrpmdir %{_topdir}/SRPMS" \
--define "_specdir %{_topdir}/SPECS" \
--define "_sourcedir  %{_topdir}/SOURCES" \
-ba SPECS/oregano.spec && echo "RPM was built"
pwd 2>&1

根据

https://github.com/starkandwayne/concourse-tutorial/tree/master/12_publishing_outputs

这应该可行,但put步骤中的目录是空的。

文档https://concourse-ci.org/put-step.html似乎没有涵盖这个主题。

我看到文件写得正确:

Wrote: /tmp/build/be0f50d1/srpm/rpmbuild/SRPMS/oregano-0.84.3-1.fc25.src.rpm Wrote: /tmp/build/be0f50d1/srpm/rpmbuild/RPMS/x86_64/oregano-0.84.3-1.fc25.x86_64.rpm Wrote: /tmp/build/be0f50d1/srpm/rpmbuild/RPMS/x86_64/oregano-debuginfo-0.84.3-1.fc25.x86_64.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.6mO3iF
+ umask 022
+ cd /tmp/build/be0f50d1/srpm/rpmbuild/BUILD
+ cd oregano
+ rm -rf /tmp/build/be0f50d1/srpm/rpmbuild/BUILDROOT/oregano-0.84.3-1.fc25.x86_64
+ exit 0
+ echo 'RPM was built' RPM was built RPM was built
+ pwd /tmp/build/be0f50d1/srpm/rpmbuild

但是当涉及put任务的output时,它找不到任何文件:

base dir: "/tmp/build/put/srpm/rpmbuild/SRPMS"
error: Could not find any matches with that regex
caused by: WalkDir entry is useless
caused by: IO error for operation on /tmp/build/put/srpm/rpmbuild/SRPMS: No such file or directory (os error 2)
caused by: No such file or directory (os error 2)

当我劫持容器时:

1: build #136, step: create-rpm, type: task
2: build #136, step: srpm, type: put

选择一个容器:1

[root@f004c6a0-adee-4735-792f-8e237f645751 be0f50d1]# ls -al
total 0
drwxr-xr-x. 1 root root  44 May 31 11:43 .
drwxr-xr-x. 1 root root  24 May 31 11:43 ..
drwxr-xr-x. 1 root root 598 May 31 11:43 git-clone-resource
drwxr-xr-x. 1 root root  16 May 31 11:43 srpm
[root@f004c6a0-adee-4735-792f-8e237f645751 be0f50d1]# ls -al srpm/rpmbuild/
BUILD/     BUILDROOT/ RPMS/      SOURCES/   SPECS/     SRPMS/     
[root@f004c6a0-adee-4735-792f-8e237f645751 be0f50d1]# ls -al srpm/rpmbuild/
BUILD/     BUILDROOT/ RPMS/      SOURCES/   SPECS/     SRPMS/     
[root@f004c6a0-adee-4735-792f-8e237f645751 be0f50d1]# ls -al srpm/rpmbuild/SRPMS/
total 1232
drwxr-xr-x. 1 root root      58 May 31 11:43 .
drwxr-xr-x. 1 root root      70 May 31 11:43 ..
-rw-r--r--. 1 root root 1260666 May 31 11:43 oregano-0.84.3-1.fc25.src.rpm

选择一个容器:2

/tmp/build/put # ls -al
total 0
drwxr-xr-x    1 root     root            82 May 31 11:43 .
drwxr-xr-x    1 root     root             6 May 31 11:43 ..
drwxr-xr-x    1 root     root           414 May 31 11:31 git-clone-resource
drwxr-xr-x    1 root     root           130 May 23 07:25 oregano-test-fedora
drwxr-xr-x    1 42949672 42949672         0 May 31 11:43 srpm
/tmp/build/put # #ls -al srpm/
/tmp/build/put # #ls -al srpm/
/tmp/build/put # #ls -al ../srpm
/tmp/build/put # ls -al ../srpm
ls: ../srpm: No such file or directory
/tmp/build/put # ls -al srpm
total 0
drwxr-xr-x    1 42949672 42949672         0 May 31 11:43 .
drwxr-xr-x    1 root     root            82 May 31 11:43 ..

那么为什么文件结构和oregano-*.src.rpm在put步骤中可用?

完整的大厅YAML在这里有用,但据我所知,没有必要https://github.com/drahnr/oregano/blob/master/.concourse.yml

1 个答案:

答案 0 :(得分:1)

问题在于:

$('#logo-upload').on('click', function() {
    uploadcare.Widget(input_selector).openDialog();
});

- task: create-rpm image: oregano-test-fedora config: platform: linux inputs: - name: git-clone-resource outputs: - name: srpm path: ../srpm 将输出放在卷外,因此内容丢失了。请注意,path: ../srpmdirinputs没有任何作用,只是更改了脚本执行的工作目录!

默认值已足够,等于outputs(或path: srpm

这有效:

path: ""