Added test environment

This commit is contained in:
Michel ten Voorde
2024-11-05 14:44:54 +01:00
parent 147b396210
commit bfb0973a19
5 changed files with 58 additions and 5 deletions

45
Jenkinsfile vendored
View File

@@ -32,7 +32,7 @@ pipeline {
}
}
stage('Push the Docker Image to DockerHUb') {
stage('Push the Docker Image to DockerHub') {
steps {
script {
withCredentials([string(credentialsId: 'c7783e4f-2f79-482f-885f-dfb39f8c02d3', variable: 'docker_hub')]) {
@@ -48,13 +48,52 @@ pipeline {
steps {
script {
kubeconfig(credentialsId: 'k3s-kubeconfig') {
sh 'cat k8s/deployment-test.yaml | sed "s/latest/$BUILD_NUMBER/g" | kubectl apply -n swiss -f -'
sh 'kubectl apply -f k8s/service-test.yaml -n swiss'
sh 'cat k8s/deployment.yaml | sed "s/latest/$BUILD_NUMBER/g" | kubectl apply -n swiss -f -'
sh 'kubectl apply -f k8s/service.yaml -n swiss'
}
}
}
}
stage('Checkout test') {
steps {
// This command checks out the source code from the SCM into the Jenkins workspace
checkout scm
}
}
stage('Build test') {
steps {
sh 'yarn install --no-progress'
sh 'npm run ng build --configuration test'
}
}
stage('Docker Build test') {
steps {
sh 'docker build -t upquark/swiss-client-test:latest -t upquark/swiss-client-test:${BUILD_NUMBER} .'
}
}
stage('Push the Docker Image to DockerHub') {
steps {
script {
withCredentials([string(credentialsId: 'c7783e4f-2f79-482f-885f-dfb39f8c02d3', variable: 'docker_hub')]) {
sh 'docker login -u upquark -p ${docker_hub}'
}
sh 'docker push upquark/swiss-client-test:latest'
sh 'docker push upquark/swiss-client-test:${BUILD_NUMBER}'
}
}
}
stage('Deploy to Kubernetes') {
steps {
script {
kubeconfig(credentialsId: 'k3s-kubeconfig') {
sh 'cat k8s/deployment-test.yaml | sed "s/latest/$BUILD_NUMBER/g" | kubectl apply -n swiss -f -'
sh 'kubectl apply -f k8s/service-test.yaml -n swiss'
}
}
}
}
}
}

View File

@@ -69,6 +69,17 @@
"with": "src/environments/environment.development.ts"
}
]
},
"test": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
}
]
}
},
"defaultConfiguration": "production"

View File

@@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: swiss-test-client
image: upquark/swiss-client:latest
image: upquark/swiss-client-test:latest
imagePullPolicy: Always
ports:
- containerPort: 4000

View File

@@ -0,0 +1,4 @@
export const environment = {
production: false,
backendUrl: "https://backend-test.badminton-toernooi.nl",
};

View File

@@ -1,5 +1,4 @@
export const environment = {
production: true,
// backendUrl: "http://swiss-backend.swiss.svc.cluster.local:8080",
backendUrl: "https://backend.badminton-toernooi.nl",
};