diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..ebca3fe601db3e18783caf53926aeca21c1f103b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,67 @@ +stages: + - build + - testing + - packaging + +build_application: + stage: build + tags: + - docker_itsoft + script: + - echo "This application will build here..." + - pwd + - echo "Build application Done!" + +lint-testing: + stage: testing + tags: + - docker_itsoft + script: + - echo "This application will lint-test here..." + - pwd + - ls -a + - echo "Lint test Done!" + +unit-testing: + stage: testing + tags: + - docker_itsoft + needs: + - job: 'lint-testing' + optional: true + before_script: + - echo "Prepare test data" + script: + - echo "This application will unit-test here..." + + - echo "Unit test Done!" + rules: + - if: '$CI_COMMIT_BRANCH == "master"' + - if: '$CI_COMMIT_BRANCH == "develop"' + - if: '$CI_PIPELINE_SOURCE == "feature_new"' + +build-image-job: + stage: packaging + tags: + - docker_itsoft + rules: + - if: '$CI_COMMIT_BRANCH == "master"' + variables: + TAG: 'latest' + - if: '$CI_COMMIT_BRANCH == "develop"' + variables: + TAG: 'dev' + image: docker:20.10.16 + services: + - docker:20.10.16-dind + parallel: + matrix: + - SERVICE: [cat, dog, child] + script: + - echo "This application will package here..." + - cd $SERVICE + - docker login docker.io -u $DOCKER_USERNAME -p $DOCKER_PWD + - docker info + - docker build -t docker.io/pathmakantha/$SERVICE:$TAG . + - docker push docker.io/pathmakantha/$SERVICE:$TAG + - echo "Packaging Done!"