Importing a Project

This lesson gives you step by step instructions to import a project into Jenkins X.

We’ll import the application stored in the vfarcic/go-demo-6 repository. We’ll use it as a guinea pig to test the import process and to flesh out potential problems we might encounter.

Fork the repository

But before we import the repository, you’ll have to fork the code. Otherwise, you won’t be able to push changes since you are not yet a collaborator on that specific repository.

Press + to interact
open "https://github.com/vfarcic/go-demo-6"

Please make sure that you are logged in and click the Fork button located in the top-right corner. Follow the on-screen instructions.

Clone the repository

Next, we need to clone the repository you just forked.

⚠️ Please replace [...] with your GitHub user before executing the commands that follow.

Press + to interact
GH_USER=[...]
git clone \
https://github.com/$GH_USER/go-demo-6.git
cd go-demo-6

Replace the master branch with the orig branch

Chances are that I did not leave the master branch in the state I intended it to be or that I’m doing something with it while you’re reading this. I might be testing some recently released Jenkins X feature, or maybe I’m trying to fix a problem from one of the examples. To be sure that you have the correct version of the code, we’ll replace the master branch with the orig branch, and push it back to GitHub.

Press + to interact
git pull
git checkout orig
git merge -s ours master --no-edit
git checkout master
git merge orig
rm -rf charts
git push

Inspect the repository #

Now you should have the intended code in the master branch of the repository you forked. Feel free to take a look at what we have by opening the repository in a browser. Fortunately, there is a jx command that does just that.

Press + to interact
jx repo --batch-mode
widget

Exploring the project files

Let’s quickly explore the files of the project before we import it into Jenkins X.

Press + to interact
ls -1

The output is as follows:

Press + to interact
README.md
functional_test.go
main.go
main_test.go
production_test.go
vendor

What

...