-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
155 lines (141 loc) · 5.39 KB
/
.gitlab-ci.yml
File metadata and controls
155 lines (141 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
stages:
- integration_build
- integration
- push
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
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
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"