try sonarqube
Signed-off-by: Frank Villaro-Dixon <frank.villarodixon@merkle.com>
This commit is contained in:
parent
11c8053422
commit
9070fadde1
3 changed files with 29 additions and 5 deletions
17
.gitlab-ci.yml
Normal file
17
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
sonarqube-check:
|
||||||
|
image:
|
||||||
|
name: sonarsource/sonar-scanner-cli:latest
|
||||||
|
entrypoint: [""]
|
||||||
|
variables:
|
||||||
|
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
||||||
|
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
||||||
|
cache:
|
||||||
|
key: "${CI_JOB_NAME}"
|
||||||
|
paths:
|
||||||
|
- .sonar/cache
|
||||||
|
script:
|
||||||
|
- sonar-scanner
|
||||||
|
allow_failure: true
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH == 'main'
|
||||||
|
|
|
@ -54,6 +54,7 @@ var (
|
||||||
wolImage = "registry.k3s.fr/k8s/docker-wakeonlan-image/main:latest"
|
wolImage = "registry.k3s.fr/k8s/docker-wakeonlan-image/main:latest"
|
||||||
shutdownImage = "registry.k3s.fr/k8s/docker-ubuntu-systemd/main:latest"
|
shutdownImage = "registry.k3s.fr/k8s/docker-ubuntu-systemd/main:latest"
|
||||||
namespace = "default"
|
namespace = "default"
|
||||||
|
podShutdownCmd = "systemctl poweroff"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (r *AnesthesiaNodeReconciler) getV1Node(an *anesthesiav1alpha1.AnesthesiaNode) (*corev1.Node, error) {
|
func (r *AnesthesiaNodeReconciler) getV1Node(an *anesthesiav1alpha1.AnesthesiaNode) (*corev1.Node, error) {
|
||||||
|
@ -160,7 +161,7 @@ func shutdownPod(shutdownNode *anesthesiav1alpha1.AnesthesiaNode) *corev1.Pod {
|
||||||
{
|
{
|
||||||
Image: shutdownImage,
|
Image: shutdownImage,
|
||||||
Name: "shutdown",
|
Name: "shutdown",
|
||||||
Command: []string{"sh", "-c", "systemctl poweroff"},
|
Command: []string{"sh", "-c", podShutdownCmd},
|
||||||
Env: []corev1.EnvVar{
|
Env: []corev1.EnvVar{
|
||||||
{
|
{
|
||||||
Name: "SYSTEMD_IGNORE_CHROOT",
|
Name: "SYSTEMD_IGNORE_CHROOT",
|
||||||
|
@ -421,13 +422,14 @@ func (r *AnesthesiaNodeReconciler) Reconcile(ctx context.Context, req ctrl.Reque
|
||||||
nodeAlive := isNodeAlive(renewTime)
|
nodeAlive := isNodeAlive(renewTime)
|
||||||
|
|
||||||
var newActualState string
|
var newActualState string
|
||||||
requeue := 0 * time.Second
|
requeue := 1 * time.Minute // Periodically watch the nodes/their state v.s. what we want
|
||||||
|
|
||||||
if node.Spec.State == "on" && nodeAlive { // FIXME
|
if node.Spec.State == "on" && nodeAlive { // FIXME
|
||||||
newActualState = "running"
|
newActualState = "running"
|
||||||
err = r.removeOldJobs(&node)
|
err = r.removeOldJobs(&node)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err, "Couldn't remove old jobs")
|
log.Error(err, "Couldn't remove old jobs")
|
||||||
return ctrl.Result{}, err
|
return ctrl.Result{RequeueAfter: requeue}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if node.Spec.State == "on" && !nodeAlive { // FIXME
|
} else if node.Spec.State == "on" && !nodeAlive { // FIXME
|
||||||
|
@ -436,11 +438,13 @@ func (r *AnesthesiaNodeReconciler) Reconcile(ctx context.Context, req ctrl.Reque
|
||||||
runningJobs, err := r.areRunningWakeupJobs(&node)
|
runningJobs, err := r.areRunningWakeupJobs(&node)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err, "Could not get running wakeup jobs")
|
log.Error(err, "Could not get running wakeup jobs")
|
||||||
return ctrl.Result{}, err
|
return ctrl.Result{RequeueAfter: requeue}, err
|
||||||
}
|
}
|
||||||
if runningJobs {
|
if runningJobs {
|
||||||
log.Info("Wakeup job still running")
|
log.Info("Wakeup job still running")
|
||||||
return ctrl.Result{RequeueAfter: time.Minute}, nil
|
// XXX we should make sure that the wakeupJob is recent,
|
||||||
|
// if not, we should recreate it (i.e. continue on)
|
||||||
|
return ctrl.Result{RequeueAfter: time.Minute}, nil // give it time to boot
|
||||||
}
|
}
|
||||||
|
|
||||||
l2Nodes, err := r.findNodesOnSameL2(v1node)
|
l2Nodes, err := r.findNodesOnSameL2(v1node)
|
||||||
|
|
3
sonar-project.properties
Normal file
3
sonar-project.properties
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
sonar.projectKey=kube-anesthesia
|
||||||
|
sonar.qualitygate.wait=true
|
||||||
|
|
Loading…
Reference in a new issue