Cloud Native 16 min read

End‑to‑End Project Delivery with GitLab CI/CD: Workflow, Pipelines, and Kubernetes Deployment

This guide details a complete GitLab‑based CI/CD workflow—from issue creation and feature‑branch handling through build, test, code‑analysis, Docker image creation, and Kubernetes deployment—illustrating pipeline configuration, variable management, and trigger rules for reliable end‑to‑end project delivery.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
End‑to‑End Project Delivery with GitLab CI/CD: Workflow, Pipelines, and Kubernetes Deployment

The document describes a full‑stack GitLab CI/CD practice that starts with issue creation, links a feature branch, and progresses through a series of pipelines to deliver an application.

1. Overall Planning outlines the end‑to‑end flow: create issue → feature branch → submit pipeline → merge pipeline → release pipeline.

2. Requirement Preparation shows how to create milestones, associate them with issues, and generate feature branches.

3. Pipeline Preparation includes preparing a template library and a runner, and configuring the project CI file.

4. Submit Pipeline Design defines the build stage with a reusable template:

.build:
  stage: build
  script:
    - ${BUILD_SHELL}

Key variables such as MAVEN_IMAGE, GIT_CLONE_PATH, and GIT_CHECKOUT are set to make the pipeline flexible for different projects.

5. Test Pipeline uses a Maven test command ( mvn test) defined in jobs/test.yml:

.test:
  stage: test
  script:
    - $TEST_SHELL
  artifacts:
    reports:
      junit: ${JUNIT_REPORT_PATH}

6. Code‑Analysis Stage runs SonarScanner with dynamically built arguments:

.code_analysis:
  stage: code_analysis
  script:
    - sonar-scanner $GLOBAL_PROJECT_ARGS $GLOBAL_SERVER_ARGS $SONAR_SCAN_ARGS $GLOBAL_MR_ARGS

7. Build Image Stage builds and pushes a Docker image:

.build-docker:
  stage: buildimage
  script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWD $CI_REGISTRY
    - docker build -t ${IMAGE_NAME} -f ${DOCKER_FILE_PATH} .
    - docker push ${IMAGE_NAME}
    - docker rmi ${IMAGE_NAME}

8. Deployment Stage uses kubectl to apply a Kubernetes manifest, creating a secret for the image registry and setting environment URLs.

.deploy_k8s:
  stage: deploy
  script:
    - kubectl config set-cluster my-cluster --server=${KUBE_URL} --certificate-authority="${KUBE_CA_PEM_FILE}"
    - kubectl config set-credentials admin --token=${KUBE_TOKEN}
    - sed -i "s#__namespace__#${NAMESPACE}#g" ${DEPLOY_FILE}
    - ...
    - kubectl apply -f ${DEPLOY_FILE}

9. Pipeline Trigger Control uses workflow:rules to skip pipelines for new branches (all‑zero SHA) and to run only on merge‑request or manual triggers.

10. Post‑Release Steps cover merging release branches into master, tagging the release, and closing related issues and milestones.

The guide concludes with a reminder to follow the DevOps Cloud Academy for more practices.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerKubernetesPipeline
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.