2017-05-31 3 views
0

Comment puis-je put le output d'un task dans une ressource?ressource de concours - sortie de tâche non disponible pour mettre

- 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 

Selon

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

cela devrait fonctionner, mais le répertoire dans l'étape de vente est vide.

La documentation https://concourse.ci/put-step.html semble pas couvrir ce sujet beaucoup.

Je vois que les fichiers sont writte correctement:

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 

Mais quand il s'agit de putoutput de la tâche, il ne trouve aucun fichier:

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) 

Quand je Hijack dans la conteneurs:

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

choisir un conteneur: 1

[[email protected] 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 
[[email protected] be0f50d1]# ls -al srpm/rpmbuild/ 
BUILD/  BUILDROOT/ RPMS/  SOURCES/ SPECS/  SRPMS/  
[[email protected] be0f50d1]# ls -al srpm/rpmbuild/ 
BUILD/  BUILDROOT/ RPMS/  SOURCES/ SPECS/  SRPMS/  
[[email protected] 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 

choisir un conteneur: 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 .. 

Alors, pourquoi est la structure de fichier, ni oregano-*.src.rpm disponible dans l'étape de vente?

Le concours complet YAML est vain ici, mais pas nécessaire pour autant que je peux dire https://github.com/drahnr/oregano/blob/master/.concourse.yml

Répondre

1

La question était la suivante:

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

path: ../srpm placé les sorties en dehors du volume et en tant que tel le le contenu a été perdu. Notez que dir ne fait rien en ce qui concerne les inputs et outputs mais change juste le workdir pour l'exécution du script!

La valeur par défaut aurait suffi qui aurait égalée à path: srpm (ou path: "")

Cela fonctionne:

- task: create-rpm 
    image: oregano-test-fedora 
    config: 
    platform: linux 
    inputs: 
    - name: git-clone-resource 
    outputs: 
    - name: srpm