Dixon Joseph Dalmeida
Dixon Joseph Dalmeida

Reputation: 322

Building Artifactory fails for Build Stage in Delivery Pipeline

I have created a toolchain, which downloads the code from the bitbucket repository and builds the docker image in IBM Cloud.

After the code builds the image, the build stage fails while building the artifactory.

Error:
Preparing the build artifacts...
Customer script does not exist for the job, exitting

I have specified the Build archive directory as the folder name. Do I need to write any scripts for archiving?

Upvotes: 0

Views: 327

Answers (2)

Ryan Morehart
Ryan Morehart

Reputation: 1

This issue appears to be caused by setting a working directory for the job. _customer_script.sh gets dropped into the working directory, but the script Simon is referring to (/opt/IBM/pipeline/bin/ids-buildables-notify.sh) only checks the top-level directory the code input is at (/home/pipeline/$TASK_ID/).

Three options to fix this, assuming you're doing a container registry job:

  1. Run cp _customer_script.sh /home/pipeline/$TASK_ID in your script. The ids-buildables-notify.sh script does some grepping for your bx cr build call, so make sure that's still in there.

  2. touch /home/pipeline/$TASK_ID/_customer_script.sh and export PIPELINE_IMAGE_URL=<your image url>. If PIPELINE_IMAGE_URL is set, the notify script doesn't bother with being clever, which I prefer.

  3. Don't change the working directory.

A script which works for me:

#!/bin/bash
echo -e "Build environment variables:"
echo "REGISTRY_URL=${REGISTRY_URL}"
echo "REGISTRY_NAMESPACE=${REGISTRY_NAMESPACE}"
echo "IMAGE_NAME=${IMAGE_NAME}"
echo "BUILD_NUMBER=${BUILD_NUMBER}"

echo -e "Building container image"
set -x
export PIPELINE_IMAGE_URL=$REGISTRY_URL/$REGISTRY_NAMESPACE/$IMAGE_NAME:$BUILD_NUMBER
bx cr build -t $PIPELINE_IMAGE_URL .
set +x

touch /home/pipeline/$TASK_ID/_customer_script.sh

Upvotes: 0

Simon Kaegi
Simon Kaegi

Reputation: 76

That particular error occurs when one of our checks -- the existence of /home/pipeline/$TASK_ID/_customer_script.sh -- fails.

Archiving happens automatically but that file needs to be present as we use it as part of the traceability around how the artifact was created. Is it possible that file is getting removed? (Also will look into removing or making the check non-fatal however that will take time)

Upvotes: 1

Related Questions