Skip to content
Snippets Groups Projects
Commit 70299987 authored by Dean Kelly's avatar Dean Kelly
Browse files

Update .gitlab-ci.yml file

parent 5ff23939
No related branches found
No related tags found
No related merge requests found
Pipeline #72934 failed
stages:
- integration_build
- integration
- push
- deploy
variables:
IMG_NAME: "quay.io/dekelly/codecoapp-acm"
IMG_TAG: "${CI_COMMIT_SHORT_SHA}"
IMG: "$IMG_NAME:$IMG_TAG"
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "" # Disable Docker TLS
# KUSTOMIZE_VERSION: 5.0.3 # Define the desired kustomize version
# KUBECONFIG: ~/.kube/config
services:
- name: docker:dind
command: ["--privileged"]
before_script:
# Install required dependencies
- dnf install -y wget make git dnf-plugins-core
# Add Docker repository
- curl -fsSL https://download.docker.com/linux/fedora/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
# Install Docker CLI
- dnf install -y docker-ce-cli
# Install Go (required for controller-gen)
- wget https://go.dev/dl/go1.21.9.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.21.9.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.10.0
- export PATH=$PATH:$(go env GOPATH)/bin
- dnf install -y curl wget git make
# Install kubectl
- echo "Installing kubectl..."
- curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- chmod +x kubectl
- mv kubectl /usr/local/bin/
- kubectl version --client # Verify kubectl installation
# Install helm
- echo "Installing helm ..."
- export VERIFY_CHECKSUM=false
- curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
- chmod 700 get_helm.sh
- ./get_helm.sh
# - mv linux-amd64/helm /usr/local/bin/helm
- helm version # Verify helm installation
# Log into Quay
- echo "Logging into Quay..."
- echo "$QUAY_PASS"
- echo "$QUAY_PASS" | docker login quay.io -username "$QUAY_USER" --password-stdin
# - docker login -u $DOCK_USER -p $DOCK_PASS
# Clone the repository
# - git clone https://gitlab.eclipse.org/eclipse-research-labs/codeco-project/acm.git
# build-deployment:
# stage: build-deployment
# tags:
# - icom-runner-codeco
# image: fedora:latest
# services:
# - name: docker:dind
# command: ["--privileged"] # Enable privileged mode
# script:
# - export PATH=$PATH:/usr/local/go/bin
# - echo "Installing Kind and kubectl..."
# - curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.18.0/kind-linux-amd64
# - chmod +x ./kind
# - mv ./kind /usr/local/bin/kind
# - curl -Lo ./kubectl https://dl.k8s.io/release/v1.24.0/bin/linux/amd64/kubectl
# - chmod +x ./kubectl
# - mv ./kubectl /usr/local/bin/kubectl
# - echo "Removing previous clusters if present..."
# - kind delete cluster --name kind
# - echo "Creating Kind cluster..."
# - kind create cluster --config ./config/cluster/kind-config.yaml
# - echo "Test cluster created."
# - kubectl config get-contexts # Check available contexts, should show 'kind-kind'
# - kubectl config use-context kind-kind # Ensure we are using the correct context
# # - cat $HOME/.kube/config
# - export KUBECONFIG=$HOME/.kube/config
# # - kubectl get pods -A --context kind-kind
# # - echo "Deploying CODECO to pods ..."
# # - make deploy IMG="quay.io/dekelly/codecov21:v0.0.1"
# artifacts:
# paths:
# - $HOME/.kube/config
# test-build:
# stage: test-build
# tags:
# - icom-runner-codeco
# image: fedora:latest
# services:
# - name: docker:dind
# command: ["--privileged"] # Enable privileged mode
# dependencies:
# - build-deployment
# script:
# - echo "Running tests..."
# - echo KUBECONFIG=$HOME/.kube/config
# - kubectl config get-contexts
# - make deploy IMG="quay.io/dekelly/codecov21:v0.0.1"
integration_build:
stage: integration_build
image: docker:26.1.2
services:
- docker:26.1.2-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
IMAGE_NAME: $CI_REGISTRY_IMAGE/integration
IMAGE_TAG: 2.0.1
only:
- icom-integration-testing
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
deploy_to_kind:
stage: deploy
image: bitnami/kubectl
script:
- echo "Building Image...."
- git clone https://gitlab.eclipse.org/eclipse-research-labs/codeco-project/gitlab-profile.git
- cd gitlab-profile/
- docker build -t $CI_REGISTRY_IMAGE/integration:$IMG_TAG -f Dockerfile-integration .
- docker push $CI_REGISTRY_IMAGE/integration:$IMG_TAG
timeout: 2h
integration:
stage: integration
image: docker:26.1.2
services:
- docker:26.1.2-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
IMAGE_NAME: $CI_REGISTRY_IMAGE/integration
IMAGE_TAG: 2.0.1
- mkdir ~/.kube
- echo "$KUBECONFIG_CONTENT" > ~/.kube/config
- kubectl create namespace my-new-namespace
only:
- icom-integration-testing
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker rm integ --force
- docker rmi $CI_REGISTRY_IMAGE/integration:$IMG_TAG
after_script:
- docker rm integ --force
# - docker rmi $CI_REGISTRY_IMAGE/integration:$IMG_TAG
script:
- git clone https://gitlab.eclipse.org/eclipse-research-labs/codeco-project/gitlab-profile.git
- cd gitlab-profile/
- docker build -t integration:test -f Dockerfile-integration .
- docker rm integ --force
- docker run -t -v /var/run/docker.sock:/var/run/docker.sock -e DOCKERHUB_USER=$DOCKERHUB_USER -e DOCKERHUB_PASS=$DOCKERHUB_PASS --network host --name integ --rm $CI_REGISTRY_IMAGE/integration:$IMG_TAG bash -c -i "/integration-script.sh --create-cluster"
- McConfig
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment