Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I access artifact files in the next step?

Péter Gebri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 23, 2018

Hello! I have a pipeline with a centos7 image. I have some artifact files in the first step and I would like to use them in the second step, but I can't do that. 

Where can I find or how can I use the artifact files in the second step?

 

Here is my code:

 

pipelines: 
branches:
master:
- step:
name: devbuild
image: centos:7
script:
- yum -y install git
- curl -LO https://storage.googleapis.com/golang/go1.10.3.linux-amd64.tar.gz
- tar -C /usr/local -xvzf go1.10.3.linux-amd64.tar.gz
- mkdir -p ~/projects/{bin,pkg,src}
- mkdir -p ~/projects/src/${BITBUCKET_REPO_SLUG}
- tar -cO --exclude-vcs --exclude=bitbucket-pipelines.yml . | tar -xv -C ~/projects/src/${BITBUCKET_REPO_SLUG}
- cd ~/projects/src/${BITBUCKET_REPO_SLUG}
- export PATH=$PATH:/usr/local/go/bin
- export GOBIN="$HOME/projects/bin"
- export GOPATH="$HOME/projects"
- go get
- go build -o "${BITBUCKET_REPO_SLUG}.cms"
- cp "${BITBUCKET_REPO_SLUG}.cms" $BITBUCKET_CLONE_DIR
artifacts:
- /${BITBUCKET_REPO_SLUG}.cms
- /assets/**/*
- /modules/**/*
- /templates/**/*
- step:
name: deploy
image: python:3.5.1
script:
- find / -name "${BITBUCKET_REPO_SLUG}.cms"
# I can't find the built .cms file on the server
# how, where can I find it and how can i use it?
 

 

Thank you for the answers,

Peter

1 answer

0 votes
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 27, 2018

Hi Peter,

Can you try the following YAML. I've annotated the changes I've made to your artifacts:

pipelines: 
branches:
master:
- step:
name: devbuild
image: centos:7
script:
- yum -y install git
- curl -LO https://storage.googleapis.com/golang/go1.10.3.linux-amd64.tar.gz
- tar -C /usr/local -xvzf go1.10.3.linux-amd64.tar.gz
- mkdir -p ~/projects/{bin,pkg,src}
- mkdir -p ~/projects/src/${BITBUCKET_REPO_SLUG}
- tar -cO --exclude-vcs --exclude=bitbucket-pipelines.yml . | tar -xv -C ~/projects/src/${BITBUCKET_REPO_SLUG}
- cd ~/projects/src/${BITBUCKET_REPO_SLUG}
- export PATH=$PATH:/usr/local/go/bin
- export GOBIN="$HOME/projects/bin"
- export GOPATH="$HOME/projects"
- go get
- go build -o "${BITBUCKET_REPO_SLUG}.cms"
- cp "${BITBUCKET_REPO_SLUG}.cms" $BITBUCKET_CLONE_DIR
artifacts:
- *.cms # Environment variables aren't supported in artifact section
- assets/**/* # Remove leading '/'
- modules/**/* # Remove leading '/'
- templates/**/* # Remove leading '/'
- step:
name: deploy
image: python:3.5.1
script:
- find / -name "${BITBUCKET_REPO_SLUG}.cms"
# I can't find the built .cms file on the server
# how, where can I find it and how can i use it?

I think the issue was that you were trying to upload off the root directory of the container, not your build directory. And I can't recall exactly, but I don't think we support environment variables in the artifacts sections. But, feel free to give it another go if everything else works now.

If that doesn't work it's probably going to be something a bit more fiddly. If that's the case, can you share:

1. The output of the 'Build teardown' of the 'devbuild' step.

2. The output of the 'Build setup' of the 'deploy' step.

Thanks,

Phil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events