Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Folders missing from git archive

I have the following pipeline script for my express and react application:

image: node:10.15.3

    - step:
        name: Installing API server dependencies
          - npm install
    - step:
        name: Install client dependencies & build
          - cd client
          - npm install
          - npm run build
    - step:
        name: Create artifact
          - git archive --format=tar.gz master -o application.tar.gz
          - application.tar.gz
    - step:
        name: Deploy to test
        deployment: test
          - pipe: atlassian/heroku-deploy:0.1.1
              ZIP_FILE: application.tar.gz

However, when the ZIP file application.tar.gz is passed to Heroku, the deployment is successful but the build folder is missing from it when I list the contents. It's almost like the step: Install client dependencies & build has had no effect, but it does run and the logs show everything I would expect to create a production build of the react app.

1 answer

1 accepted

0 votes
Answer accepted

Technically the folder isn't missing as git-archive does only contain files (objects) from the repository - not the working tree.

What you could do is create the archive first, then append the build directory to it and finally compress it:

git archive --format=tar master -o application.tar
tar --append --file=application.tar build
gzip application.tar

Hi @ktomk, that makes sense to me, however when I try the above I just get the following message:

tar: client/build: Cannot stat: No such file or directory 

Are there other steps I need to complete for this to work? The location of my react app builder folder is in client/build.

Will I also need to append node_modules? I basically just want to release a finished artifact to  Heroku.


relative from the base directory, which files / directories do you need in application.tar in the end?

Hi @ktomk, I figured it out! Thanks for your initial answer, it helped me a lot. This was the completed steps I ended up with in the end:

- step:
name: Install client app dependencies & build
    - cd client
      - npm install
      - npm run build
      - client/build/**

- step:
    name: Create artifact
    - git archive --format=tar master -o app.tar
      - tar --append --file=app.tar client/build
      - gzip app.tar
      - app.tar.gz
Like ktomk likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

166 views 2 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you