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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,391
Community Members
 
Community Events
184
Community Groups

CICD best practices

Edited

Hi everyone, I would like to ask you a few questions (hoping I'm not totally off the mark).

We have a little "CICD" and I have to improve it. I'm a junior so I'm a little bit confused with some informations I've found.
Indeed, we have a simple system : git, test servers and a production server.

We have configured pipelines in order to be able to launch our unit tests and then trigger the delivery of the files to the server concerned (the delivery in production is totally manual for the moment).
During the merge in the branch corresponding to the concerned server, the steps are the following:
- the unit tests are launched as this :

      - apt-get update && apt-get install -y unzip libpng-dev zlib1g-dev libzip-dev
      - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
      - docker-php-ext-install gd zip
      - composer install
      - composer require --dev mockery/mockery
      - ./vendor/bin/phpunit ./tests --testdox --colors=always


- once this step is over, a bash script is called
- this bash script allows to update the git repository and the dependencies (npm and composer in particular). So this command is launched :

       'git reset --hard && git checkout $branch_name && git pull' "Update Git repository"


My questions are : 
Is it possible to do these steps without having the .git file on the concerned server ?
Is it recommended or not to use git in a CICD ?
Is it possible to run unit tests without installing php unit (via composer) ? 

Thanks for your time :)

1 answer

0 votes
Erez Maadani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 26, 2022

Hi @Suzy Rollandin

1. Git uses the .git folder to manage the containing folder as a git repository. This folder is used to mark the folder as managed by git and to hold all metadata relevant to the repo: HEAD commit hash, branches' hashes, etc'. The .git folder is created usually upon `git init` (creating new repo locally) or `git clone` (cloning a repo from a remote server). To answer your question, if you don't have the .git folder locally, it means you have to clone the repo you wish to build. If you do have the .git folder, it usually means that you just need to pull the latest changes and checkout the relevant branch for the build. The latter is usually faster (no need to clone the repo), and the first option is a bit more stable as you don't relay nor affected by current state of the build directory.

2. It depends on your requirements from the CICD and your preferred methodology. Many teams generate the version during the build and then commit & push it back into the repository. Some teams/organizations object using git directly during the build as it allows developers to commit & push code w/o going through pull request.

3. If installing php-unit has to be via composer - I don't know. However, the php-unit is a dependency, and as such, you can either fetch & install it during build time or run your builds on servers/containers which already include this dependency.         

Hi @Erez Maadani thank you so much for your answers :) 
I will work on it ! 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events