From d58ec5ef383cf1cb5b16695439ec19486f719f6b Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Wed, 2 Apr 2025 00:12:30 +0530 Subject: [PATCH 01/43] modified web pages --- go.mod | 2 +- static/about.html | 6 +++--- static/contact.html | 2 +- static/courses.html | 2 +- static/home.html | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index d23044355..74d19c1fe 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/iam-veeramalla/go-web-app +module github.com/niteshtheqa/go-web-app go 1.22.5 diff --git a/static/about.html b/static/about.html index d01fd9813..13510b07c 100644 --- a/static/about.html +++ b/static/about.html @@ -64,7 +64,7 @@

About the Author

-

Hi Everyone, My name is Abhishek and welcome to my channel :)

+

Hi Everyone, My name isNitesh and welcome to my channel :)

I am an opensource enthusiast and a great believer in sharing knowledge.

I have my footprints in popular opensource projects like Argo CD, Argo CD Operator, Argo Rollouts Manager, GitOps Operator, F5 Ingress Controller, Nginx Ingress Controller by Nginx and others.

@@ -77,14 +77,14 @@

About the Author

- Member of Argo SIG Security

If you want to learn complete devops for free with practical projects, checkout the playlist

-

Playlists

+

Playlists

Please subscribe to the channel to keep learning and growing together. Thanks :)

diff --git a/static/contact.html b/static/contact.html index aa516b5ce..a3de9b9d1 100644 --- a/static/contact.html +++ b/static/contact.html @@ -65,4 +65,4 @@

Contact Us

For any doubts while learning, Join our Members only exclusive slack channel

- Join Slack \ No newline at end of file + Join Slack \ No newline at end of file diff --git a/static/courses.html b/static/courses.html index f0443aaa2..7508b0775 100644 --- a/static/courses.html +++ b/static/courses.html @@ -86,7 +86,7 @@

Troubleshooting Tutorials

-

© Abhishek.Veeramalla

+

© nitesh Wayafalkar

diff --git a/static/home.html b/static/home.html index a5b703b6b..8e1cca50c 100644 --- a/static/home.html +++ b/static/home.html @@ -85,7 +85,7 @@

Courses Offered

-

© Abhishek.Veeramalla

+

© Nitesh Wayafalkar

From 572a0d959459f331a2f6a4c0e9ffea54474b8d1b Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Wed, 2 Apr 2025 02:48:58 +0530 Subject: [PATCH 02/43] added k8s and dockerfile --- Dockerfile | 26 ++++++++++++++++++++++++++ k8s/Deployment.yml | 27 +++++++++++++++++++++++++++ k8s/Ingress.yml | 22 ++++++++++++++++++++++ k8s/Service.yml | 17 +++++++++++++++++ k8s/namespace.yml | 4 ++++ 5 files changed, 96 insertions(+) create mode 100644 Dockerfile create mode 100644 k8s/Deployment.yml create mode 100644 k8s/Ingress.yml create mode 100644 k8s/Service.yml create mode 100644 k8s/namespace.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..3a49dc63e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM golang:1.22.5 as base + +WORKDIR /app + +COPY go.mod ./ + +RUN go mod download + +COPY . . + +RUN go build -o /app/main . + +######################## +#Reduce images size by using multistage dockerfile +######################### +FROM gcr.io/distroless/base + +COPY --from=base /app/main . + +COPY --from=base /app/static ./static + +EXPOSE 8080 + +CMD ["./main"] + + diff --git a/k8s/Deployment.yml b/k8s/Deployment.yml new file mode 100644 index 000000000..e745d3ee4 --- /dev/null +++ b/k8s/Deployment.yml @@ -0,0 +1,27 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: go-web-app + namespace: go-web-app + labels: + app: go-web-app +spec: + selector: + matchLabels: + app: go-web-app + replicas: 1 + template: + metadata: + labels: + app: go-web-app + spec: + # initContainers: + # Init containers are exactly like regular containers, except: + # - Init containers always run to completion. + # - Each init container must complete successfully before the next one starts. + containers: + - name: go-web-app + image: nitesh2611/golang-web-app:v1 + ports: + - containerPort: 8080 + imagePullPolicy: IfNotPresent \ No newline at end of file diff --git a/k8s/Ingress.yml b/k8s/Ingress.yml new file mode 100644 index 000000000..14ced675f --- /dev/null +++ b/k8s/Ingress.yml @@ -0,0 +1,22 @@ +# https://kubernetes.io/docs/concepts/services-networking/ingress/#the-ingress-resource + +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: go-web-app-ingress + namespace: go-web-app + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + ingressClassName: nginx + rules: + - host: go-web-app.local + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: go-web-svc + port: + number: 80 \ No newline at end of file diff --git a/k8s/Service.yml b/k8s/Service.yml new file mode 100644 index 000000000..53ff7fd91 --- /dev/null +++ b/k8s/Service.yml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: go-web-svc + namespace: go-web-app +spec: + selector: + app: go-web-app + type: ClusterIP + ports: + - name: http + protocol: TCP + port: 80 + targetPort: 8080 + # If you set the `spec.type` field to `NodePort` and you want a specific port number, + # you can specify a value in the `spec.ports[*].nodePort` field. + \ No newline at end of file diff --git a/k8s/namespace.yml b/k8s/namespace.yml new file mode 100644 index 000000000..41dc2238d --- /dev/null +++ b/k8s/namespace.yml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: go-web-app From 2274a58cfe982d6bf0665998dd592d7fefced322 Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Thu, 3 Apr 2025 01:22:35 +0530 Subject: [PATCH 03/43] implement github actions --- .github/workflows/ci.yml | 29 + eks-cluster/cluster-config.yml | 14 + helm/go-web-app-chart/.helmignore | 23 + helm/go-web-app-chart/Chart.yaml | 24 + .../go-web-app-chart/templates/deployment.yml | 34 + helm/go-web-app-chart/templates/ingress.yml | 23 + helm/go-web-app-chart/templates/namespace.yml | 4 + helm/go-web-app-chart/templates/service.yml | 17 + helm/go-web-app-chart/values.yaml | 123 ++++ ingress-contrller/ingress-conteller.yml | 670 ++++++++++++++++++ k8s/Deployment.yml | 11 +- k8s/Ingress.yml | 2 +- k8s/Service.yml | 2 +- static/about.html | 4 +- static/courses.html | 2 +- static/home.html | 2 +- 16 files changed, 976 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 eks-cluster/cluster-config.yml create mode 100644 helm/go-web-app-chart/.helmignore create mode 100644 helm/go-web-app-chart/Chart.yaml create mode 100644 helm/go-web-app-chart/templates/deployment.yml create mode 100644 helm/go-web-app-chart/templates/ingress.yml create mode 100644 helm/go-web-app-chart/templates/namespace.yml create mode 100644 helm/go-web-app-chart/templates/service.yml create mode 100644 helm/go-web-app-chart/values.yaml create mode 100644 ingress-contrller/ingress-conteller.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..f7bc7ffa4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: + - main + paths-ignore: + - "helm/**" + - "README.md" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.20' + + - name: Install dependencies + run: go mod download + + - name: Run tests + run: go test ./... + + \ No newline at end of file diff --git a/eks-cluster/cluster-config.yml b/eks-cluster/cluster-config.yml new file mode 100644 index 000000000..f64825ff4 --- /dev/null +++ b/eks-cluster/cluster-config.yml @@ -0,0 +1,14 @@ +apiVersion: eksctl.io/v1alpha5 +kind: ClusterConfig + +metadata: + name: go-app-cluster + region: ap-south-1 + +nodeGroups: + - name: go-app-node + instanceType: m5.xlarge + desiredCapacity: 1 + volumeSize: 100 + ssh: + allow: true \ No newline at end of file diff --git a/helm/go-web-app-chart/.helmignore b/helm/go-web-app-chart/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm/go-web-app-chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/go-web-app-chart/Chart.yaml b/helm/go-web-app-chart/Chart.yaml new file mode 100644 index 000000000..5d5e4a81b --- /dev/null +++ b/helm/go-web-app-chart/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: go-web-app-chart +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/helm/go-web-app-chart/templates/deployment.yml b/helm/go-web-app-chart/templates/deployment.yml new file mode 100644 index 000000000..c51d765e0 --- /dev/null +++ b/helm/go-web-app-chart/templates/deployment.yml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: go-web-app + namespace: go-web-app + labels: + app: go-web-app +spec: + selector: + matchLabels: + app: go-web-app + replicas: 1 + template: + metadata: + labels: + app: go-web-app + spec: + # initContainers: + # Init containers are exactly like regular containers, except: + # - Init containers always run to completion. + # - Each init container must complete successfully before the next one starts. + containers: + - name: go-web-app + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + ports: + - containerPort: 8080 + imagePullPolicy: Always + resources: + requests: + memory: "64Mi" + cpu: "250m" + limits: + memory: "128Mi" + cpu: "500m" \ No newline at end of file diff --git a/helm/go-web-app-chart/templates/ingress.yml b/helm/go-web-app-chart/templates/ingress.yml new file mode 100644 index 000000000..c4b913ad0 --- /dev/null +++ b/helm/go-web-app-chart/templates/ingress.yml @@ -0,0 +1,23 @@ +# https://kubernetes.io/docs/concepts/services-networking/ingress/#the-ingress-resource + +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: go-web-app-ingress + namespace: go-web-app + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + ingressClassName: nginx + rules: + - host: www.youtube-academy.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: go-web-svc + port: + number: 80 + \ No newline at end of file diff --git a/helm/go-web-app-chart/templates/namespace.yml b/helm/go-web-app-chart/templates/namespace.yml new file mode 100644 index 000000000..41dc2238d --- /dev/null +++ b/helm/go-web-app-chart/templates/namespace.yml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: go-web-app diff --git a/helm/go-web-app-chart/templates/service.yml b/helm/go-web-app-chart/templates/service.yml new file mode 100644 index 000000000..6fcc44803 --- /dev/null +++ b/helm/go-web-app-chart/templates/service.yml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: go-web-svc + namespace: go-web-app +spec: + selector: + app: go-web-app + type: NodePort + ports: + - name: http + protocol: TCP + port: 80 + targetPort: 8080 + # If you set the `spec.type` field to `NodePort` and you want a specific port number, + # you can specify a value in the `spec.ports[*].nodePort` field. + \ No newline at end of file diff --git a/helm/go-web-app-chart/values.yaml b/helm/go-web-app-chart/values.yaml new file mode 100644 index 000000000..64bcf3719 --- /dev/null +++ b/helm/go-web-app-chart/values.yaml @@ -0,0 +1,123 @@ +# Default values for go-web-app-chart. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ +replicaCount: 1 + +# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/ +image: + repository: "nitesh2611/go-web-app" + # This sets the pull policy for images. + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "1.0.1" + +# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# This is to override the chart name. +nameOverride: "" +fullnameOverride: "" + +# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/ +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# This is for setting Kubernetes Annotations to a Pod. +# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +podAnnotations: {} +# This is for setting Kubernetes Labels to a Pod. +# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/ +service: + # This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + type: ClusterIP + # This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports + port: 80 + +# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/ +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: www.youtube-academy.com + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ +livenessProbe: + httpGet: + path: / + port: http +readinessProbe: + httpGet: + path: / + port: http + +# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/ +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/ingress-contrller/ingress-conteller.yml b/ingress-contrller/ingress-conteller.yml new file mode 100644 index 000000000..0b6af86c0 --- /dev/null +++ b/ingress-contrller/ingress-conteller.yml @@ -0,0 +1,670 @@ +# kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.1/deploy/static/provider/aws/deploy.yaml +apiVersion: v1 +kind: Namespace +metadata: + labels: + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + name: ingress-nginx +--- +apiVersion: v1 +automountServiceAccountToken: true +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx + namespace: ingress-nginx +--- +apiVersion: v1 +automountServiceAccountToken: true +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-admission + namespace: ingress-nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx + namespace: ingress-nginx +rules: +- apiGroups: + - "" + resources: + - namespaces + verbs: + - get +- apiGroups: + - "" + resources: + - configmaps + - pods + - secrets + - endpoints + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - services + verbs: + - get + - list + - watch +- apiGroups: + - networking.k8s.io + resources: + - ingresses + verbs: + - get + - list + - watch +- apiGroups: + - networking.k8s.io + resources: + - ingresses/status + verbs: + - update +- apiGroups: + - networking.k8s.io + resources: + - ingressclasses + verbs: + - get + - list + - watch +- apiGroups: + - coordination.k8s.io + resourceNames: + - ingress-nginx-leader + resources: + - leases + verbs: + - get + - update +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +- apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - list + - watch + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-admission + namespace: ingress-nginx +rules: +- apiGroups: + - "" + resources: + - secrets + verbs: + - get + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx +rules: +- apiGroups: + - "" + resources: + - configmaps + - endpoints + - nodes + - pods + - secrets + - namespaces + verbs: + - list + - watch +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - list + - watch +- apiGroups: + - "" + resources: + - nodes + verbs: + - get +- apiGroups: + - "" + resources: + - services + verbs: + - get + - list + - watch +- apiGroups: + - networking.k8s.io + resources: + - ingresses + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +- apiGroups: + - networking.k8s.io + resources: + - ingresses/status + verbs: + - update +- apiGroups: + - networking.k8s.io + resources: + - ingressclasses + verbs: + - get + - list + - watch +- apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - list + - watch + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-admission +rules: +- apiGroups: + - admissionregistration.k8s.io + resources: + - validatingwebhookconfigurations + verbs: + - get + - update +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx + namespace: ingress-nginx +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: ingress-nginx +subjects: +- kind: ServiceAccount + name: ingress-nginx + namespace: ingress-nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-admission + namespace: ingress-nginx +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: ingress-nginx-admission +subjects: +- kind: ServiceAccount + name: ingress-nginx-admission + namespace: ingress-nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: ingress-nginx +subjects: +- kind: ServiceAccount + name: ingress-nginx + namespace: ingress-nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-admission +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: ingress-nginx-admission +subjects: +- kind: ServiceAccount + name: ingress-nginx-admission + namespace: ingress-nginx +--- +apiVersion: v1 +data: null +kind: ConfigMap +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-controller + namespace: ingress-nginx +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp + service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true" + service.beta.kubernetes.io/aws-load-balancer-type: nlb + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-controller + namespace: ingress-nginx +spec: + externalTrafficPolicy: Local + ipFamilies: + - IPv4 + ipFamilyPolicy: SingleStack + ports: + - appProtocol: http + name: http + port: 80 + protocol: TCP + targetPort: http + - appProtocol: https + name: https + port: 443 + protocol: TCP + targetPort: https + selector: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + type: LoadBalancer +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-controller-admission + namespace: ingress-nginx +spec: + ports: + - appProtocol: https + name: https-webhook + port: 443 + targetPort: webhook + selector: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + type: ClusterIP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-controller + namespace: ingress-nginx +spec: + minReadySeconds: 0 + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + strategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + template: + metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + spec: + containers: + - args: + - /nginx-ingress-controller + - --publish-service=$(POD_NAMESPACE)/ingress-nginx-controller + - --election-id=ingress-nginx-leader + - --controller-class=k8s.io/ingress-nginx + - --ingress-class=nginx + - --configmap=$(POD_NAMESPACE)/ingress-nginx-controller + - --validating-webhook=:8443 + - --validating-webhook-certificate=/usr/local/certificates/cert + - --validating-webhook-key=/usr/local/certificates/key + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: LD_PRELOAD + value: /usr/local/lib/libmimalloc.so + image: registry.k8s.io/ingress-nginx/controller:v1.12.1@sha256:d2fbc4ec70d8aa2050dd91a91506e998765e86c96f32cffb56c503c9c34eed5b + imagePullPolicy: IfNotPresent + lifecycle: + preStop: + exec: + command: + - /wait-shutdown + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: 10254 + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + name: controller + ports: + - containerPort: 80 + name: http + protocol: TCP + - containerPort: 443 + name: https + protocol: TCP + - containerPort: 8443 + name: webhook + protocol: TCP + readinessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: 10254 + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + resources: + requests: + cpu: 100m + memory: 90Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + add: + - NET_BIND_SERVICE + drop: + - ALL + readOnlyRootFilesystem: false + runAsGroup: 82 + runAsNonRoot: true + runAsUser: 101 + seccompProfile: + type: RuntimeDefault + volumeMounts: + - mountPath: /usr/local/certificates/ + name: webhook-cert + readOnly: true + dnsPolicy: ClusterFirst + nodeSelector: + kubernetes.io/os: linux + serviceAccountName: ingress-nginx + terminationGracePeriodSeconds: 300 + volumes: + - name: webhook-cert + secret: + secretName: ingress-nginx-admission +--- +apiVersion: batch/v1 +kind: Job +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-admission-create + namespace: ingress-nginx +spec: + template: + metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-admission-create + spec: + containers: + - args: + - create + - --host=ingress-nginx-controller-admission,ingress-nginx-controller-admission.$(POD_NAMESPACE).svc + - --namespace=$(POD_NAMESPACE) + - --secret-name=ingress-nginx-admission + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.5.2@sha256:e8825994b7a2c7497375a9b945f386506ca6a3eda80b89b74ef2db743f66a5ea + imagePullPolicy: IfNotPresent + name: create + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsGroup: 65532 + runAsNonRoot: true + runAsUser: 65532 + seccompProfile: + type: RuntimeDefault + nodeSelector: + kubernetes.io/os: linux + restartPolicy: OnFailure + serviceAccountName: ingress-nginx-admission +--- +apiVersion: batch/v1 +kind: Job +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-admission-patch + namespace: ingress-nginx +spec: + template: + metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-admission-patch + spec: + containers: + - args: + - patch + - --webhook-name=ingress-nginx-admission + - --namespace=$(POD_NAMESPACE) + - --patch-mutating=false + - --secret-name=ingress-nginx-admission + - --patch-failure-policy=Fail + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.5.2@sha256:e8825994b7a2c7497375a9b945f386506ca6a3eda80b89b74ef2db743f66a5ea + imagePullPolicy: IfNotPresent + name: patch + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsGroup: 65532 + runAsNonRoot: true + runAsUser: 65532 + seccompProfile: + type: RuntimeDefault + nodeSelector: + kubernetes.io/os: linux + restartPolicy: OnFailure + serviceAccountName: ingress-nginx-admission +--- +apiVersion: networking.k8s.io/v1 +kind: IngressClass +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: nginx +spec: + controller: k8s.io/ingress-nginx +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/version: 1.12.1 + name: ingress-nginx-admission +webhooks: +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: ingress-nginx-controller-admission + namespace: ingress-nginx + path: /networking/v1/ingresses + port: 443 + failurePolicy: Fail + matchPolicy: Equivalent + name: validate.nginx.ingress.kubernetes.io + rules: + - apiGroups: + - networking.k8s.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - ingresses + sideEffects: None \ No newline at end of file diff --git a/k8s/Deployment.yml b/k8s/Deployment.yml index e745d3ee4..288ffa098 100644 --- a/k8s/Deployment.yml +++ b/k8s/Deployment.yml @@ -21,7 +21,14 @@ spec: # - Each init container must complete successfully before the next one starts. containers: - name: go-web-app - image: nitesh2611/golang-web-app:v1 + image: nitesh2611/go-web-app:1.0.1 ports: - containerPort: 8080 - imagePullPolicy: IfNotPresent \ No newline at end of file + imagePullPolicy: Always + resources: + requests: + memory: "64Mi" + cpu: "250m" + limits: + memory: "128Mi" + cpu: "500m" \ No newline at end of file diff --git a/k8s/Ingress.yml b/k8s/Ingress.yml index 14ced675f..4122958d4 100644 --- a/k8s/Ingress.yml +++ b/k8s/Ingress.yml @@ -10,7 +10,7 @@ metadata: spec: ingressClassName: nginx rules: - - host: go-web-app.local + - host: www.youtube-academy.com http: paths: - path: / diff --git a/k8s/Service.yml b/k8s/Service.yml index 53ff7fd91..6fcc44803 100644 --- a/k8s/Service.yml +++ b/k8s/Service.yml @@ -6,7 +6,7 @@ metadata: spec: selector: app: go-web-app - type: ClusterIP + type: NodePort ports: - name: http protocol: TCP diff --git a/static/about.html b/static/about.html index 13510b07c..ed42384e4 100644 --- a/static/about.html +++ b/static/about.html @@ -64,7 +64,7 @@

About the Author

-

Hi Everyone, My name isNitesh and welcome to my channel :)

+

Hi Everyone, My name is John and welcome to my channel :)

I am an opensource enthusiast and a great believer in sharing knowledge.

I have my footprints in popular opensource projects like Argo CD, Argo CD Operator, Argo Rollouts Manager, GitOps Operator, F5 Ingress Controller, Nginx Ingress Controller by Nginx and others.

@@ -84,7 +84,7 @@

About the Author

-

© Nitesh.Wayafalkar

+

© John.Doe

diff --git a/static/courses.html b/static/courses.html index 7508b0775..1044effbb 100644 --- a/static/courses.html +++ b/static/courses.html @@ -86,7 +86,7 @@

Troubleshooting Tutorials

-

© nitesh Wayafalkar

+

© John.Doe

diff --git a/static/home.html b/static/home.html index 8e1cca50c..56083b65f 100644 --- a/static/home.html +++ b/static/home.html @@ -85,7 +85,7 @@

Courses Offered

-

© Nitesh Wayafalkar

+

© John.Doe

From b5933ab92dac3785ec57e4dd61e6707f48d0882e Mon Sep 17 00:00:00 2001 From: niteshops Date: Thu, 3 Apr 2025 01:28:24 +0530 Subject: [PATCH 04/43] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 74d19c1fe..ad334fe93 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/niteshtheqa/go-web-app -go 1.22.5 +go 1.23 From c76481e22dcd4579fb92c9e6ea7b3aa77a5d5ffe Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Thu, 3 Apr 2025 01:30:32 +0530 Subject: [PATCH 05/43] go version change --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index ad334fe93..a69952f9d 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/niteshtheqa/go-web-app -go 1.23 +go 1.23.0 From 873711edd2d5dd997eec9ad204dd40a5e8352a73 Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Thu, 3 Apr 2025 01:32:16 +0530 Subject: [PATCH 06/43] go version change --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a69952f9d..ad334fe93 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/niteshtheqa/go-web-app -go 1.23.0 +go 1.23 From bea5fc12297c166f8bd9ce26d7c09e0a0a00786d Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Thu, 3 Apr 2025 01:37:11 +0530 Subject: [PATCH 07/43] go version change --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index ad334fe93..20e2b617c 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/niteshtheqa/go-web-app -go 1.23 +go 1.23.4 From 3a3cc67648c259bcfaf654aebdcfd07bb2851cad Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Thu, 3 Apr 2025 01:38:01 +0530 Subject: [PATCH 08/43] go version change --- .github/workflows/ci.yml | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7bc7ffa4..8fb655989 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: '1.20' + go-version: '1.23' - name: Install dependencies run: go mod download diff --git a/go.mod b/go.mod index 20e2b617c..ad334fe93 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/niteshtheqa/go-web-app -go 1.23.4 +go 1.23 From 5e17d7d37f89fc06fc242e930a3bd8e9c39674bf Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Thu, 3 Apr 2025 23:57:52 +0530 Subject: [PATCH 09/43] added sonarqube scan --- .github/workflows/ci.yml | 18 +++++++++++++++++- eks-cluster/cluster-config.yml | 2 +- ingress-contrller/ingress-conteller.yml | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fb655989..18471b0f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,5 +25,21 @@ jobs: - name: Run tests run: go test ./... - + + sonarqube-analysis: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Sonarqube Scan + uses: sonarsoruce/sonarqube-scan-action@master + with: + projectBaseDir: app/src + args: > + -Dsonar.organization=niteshops + -Dsonar.projectKey=Go-Web-Application + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} \ No newline at end of file diff --git a/eks-cluster/cluster-config.yml b/eks-cluster/cluster-config.yml index f64825ff4..5228595de 100644 --- a/eks-cluster/cluster-config.yml +++ b/eks-cluster/cluster-config.yml @@ -2,7 +2,7 @@ apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: - name: go-app-cluster + name: go-app region: ap-south-1 nodeGroups: diff --git a/ingress-contrller/ingress-conteller.yml b/ingress-contrller/ingress-conteller.yml index 0b6af86c0..a9e3a48ab 100644 --- a/ingress-contrller/ingress-conteller.yml +++ b/ingress-contrller/ingress-conteller.yml @@ -1,4 +1,5 @@ # kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.1/deploy/static/provider/aws/deploy.yaml +# kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.1/deploy/static/provider/aws/deploy.yaml apiVersion: v1 kind: Namespace metadata: From 668537cae9c9dd682b90cf61288ed62d7790a259 Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Thu, 3 Apr 2025 23:59:53 +0530 Subject: [PATCH 10/43] changed checkout version --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18471b0f2..614089d4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v4 with: go-version: '1.23' @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Sonarqube Scan uses: sonarsoruce/sonarqube-scan-action@master From 2a56583a82317264386986baa7508d4932b51378 Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Fri, 4 Apr 2025 00:04:18 +0530 Subject: [PATCH 11/43] changed set up go version --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 614089d4e..69cc4269e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v2 with: go-version: '1.23' @@ -27,6 +27,7 @@ jobs: run: go test ./... sonarqube-analysis: + needs: [build] runs-on: ubuntu-latest steps: - name: Checkout code From 2444d32d39b2e681f3ff3f8219f2640a2fc10cb0 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 00:07:37 +0530 Subject: [PATCH 12/43] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69cc4269e..d208f7d0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v4 - name: Sonarqube Scan - uses: sonarsoruce/sonarqube-scan-action@master + uses: sonarsoruce/sonarqube-scan-action@cache with: projectBaseDir: app/src args: > @@ -43,4 +43,4 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - \ No newline at end of file + From f220a7b21b51d77c95fde5b2d1d7ee53e1c4de10 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 00:09:29 +0530 Subject: [PATCH 13/43] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d208f7d0f..c5baa3b89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v4 - name: Sonarqube Scan - uses: sonarsoruce/sonarqube-scan-action@cache + uses: sonarsoruce/sonarqube-scan-action@v5 with: projectBaseDir: app/src args: > From be4d1365cc820f2707bf0240ab534339e18b802e Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Fri, 4 Apr 2025 00:13:16 +0530 Subject: [PATCH 14/43] changed working dir --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5baa3b89..6cd657a69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Sonarqube Scan uses: sonarsoruce/sonarqube-scan-action@v5 with: - projectBaseDir: app/src + projectBaseDir: app/ args: > -Dsonar.organization=niteshops -Dsonar.projectKey=Go-Web-Application From ea0234bcb4c5c46568879e580a147c6c31f70a2e Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Fri, 4 Apr 2025 00:22:48 +0530 Subject: [PATCH 15/43] changed working dir --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6cd657a69..e70dcb5cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,7 @@ jobs: sonarqube-analysis: needs: [build] runs-on: ubuntu-latest + continue-on-error: true steps: - name: Checkout code uses: actions/checkout@v4 @@ -36,7 +37,7 @@ jobs: - name: Sonarqube Scan uses: sonarsoruce/sonarqube-scan-action@v5 with: - projectBaseDir: app/ + projectBaseDir: /app args: > -Dsonar.organization=niteshops -Dsonar.projectKey=Go-Web-Application From bb7445dbc8674321fcfa0ec8032f22fe01592e56 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 00:24:25 +0530 Subject: [PATCH 16/43] Update ci.yml --- .github/workflows/ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e70dcb5cf..9e9ebd4a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,12 +35,7 @@ jobs: uses: actions/checkout@v4 - name: Sonarqube Scan - uses: sonarsoruce/sonarqube-scan-action@v5 - with: - projectBaseDir: /app - args: > - -Dsonar.organization=niteshops - -Dsonar.projectKey=Go-Web-Application + uses: sonarsoruce/sonarqube-scan-action@v1 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} From 518db9865017fc65fd41a7e7aaf940ff9bc6b983 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 00:36:25 +0530 Subject: [PATCH 17/43] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e9ebd4a0..17c21a92b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: uses: actions/checkout@v4 - name: Sonarqube Scan - uses: sonarsoruce/sonarqube-scan-action@v1 + uses: SonarSource/sonarqube-scan-action@v4 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} From eac2000fe877b85f80e871d2274324b8799ebc48 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 00:40:14 +0530 Subject: [PATCH 18/43] Update ci.yml --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17c21a92b..159ebe6a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,11 @@ jobs: - name: Sonarqube Scan uses: SonarSource/sonarqube-scan-action@v4 + with: + projectBaseDir: /app + args: > + -Dsonar.organization=niteshops-github-action + -Dsonar.projectKey=GO-Web-Application env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} From 08ffea86476776753284d220e649755b733164ca Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 00:41:32 +0530 Subject: [PATCH 19/43] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 159ebe6a4..baea95c47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: - name: Sonarqube Scan uses: SonarSource/sonarqube-scan-action@v4 with: - projectBaseDir: /app + projectBaseDir: go-web-app args: > -Dsonar.organization=niteshops-github-action -Dsonar.projectKey=GO-Web-Application From 8bd30e7848ebf3c2db1ff6776520b7664a6436bc Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 00:46:03 +0530 Subject: [PATCH 20/43] Update ci.yml --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index baea95c47..99058eaaf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + + - name: Print GITHUB_WORKSPACE + run: echo ${GITHUB_WORKSPACE} - name: Sonarqube Scan uses: SonarSource/sonarqube-scan-action@v4 From 47c3d7efaa993a6e29cc6a55ba30359030f4f19e Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 00:50:12 +0530 Subject: [PATCH 21/43] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99058eaaf..c22042734 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - name: Sonarqube Scan uses: SonarSource/sonarqube-scan-action@v4 with: - projectBaseDir: go-web-app + projectBaseDir: go-web-app/ args: > -Dsonar.organization=niteshops-github-action -Dsonar.projectKey=GO-Web-Application From 655f32f8ae2693452828780d37016540a9c1bc11 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 00:53:15 +0530 Subject: [PATCH 22/43] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c22042734..8d0ef44b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - name: Sonarqube Scan uses: SonarSource/sonarqube-scan-action@v4 with: - projectBaseDir: go-web-app/ + projectBaseDir: ./... args: > -Dsonar.organization=niteshops-github-action -Dsonar.projectKey=GO-Web-Application From 5bb91b74051b9c0090f77890c896aed98d774247 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 01:02:05 +0530 Subject: [PATCH 23/43] Update ci.yml --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d0ef44b0..9e20f1733 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,9 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Print GITHUB_WORKSPACE + run: echo ${GITHUB_WORKSPACE} + - name: Set up Go uses: actions/setup-go@v2 with: From bc6d0ce84d1b1e89ea66bb705f56fe25a21b94bb Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 01:04:01 +0530 Subject: [PATCH 24/43] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e20f1733..a735fc1e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: - name: Sonarqube Scan uses: SonarSource/sonarqube-scan-action@v4 with: - projectBaseDir: ./... + projectBaseDir: /home/runner/work/go-web-app/go-web-app args: > -Dsonar.organization=niteshops-github-action -Dsonar.projectKey=GO-Web-Application From 1c737d051f2523604774810da8c2adc587e87dd9 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 01:11:49 +0530 Subject: [PATCH 25/43] Update ci.yml added sonarqube-quality gate check --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a735fc1e4..aa76c378d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,6 @@ jobs: sonarqube-analysis: needs: [build] runs-on: ubuntu-latest - continue-on-error: true steps: - name: Checkout code uses: actions/checkout@v4 @@ -50,4 +49,29 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - + + sonarqube-quality-gate-check: + needs: [build,sonarqube-analysis] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Print GITHUB_WORKSPACE + run: echo ${GITHUB_WORKSPACE} + # Check the Quality Gate status. + - name: SonarQube Quality Gate check + id: sonarqube-quality-gate-check + uses: sonarsource/sonarqube-quality-gate-action@master + with: + pollingTimeoutSec: 600 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} #OPTIONAL + + # Optionally you can use the output from the Quality Gate in another step. + # The possible outputs of the `quality-gate-status` variable are `PASSED`, `WARN` or `FAILED`. + - name: "Example show SonarQube Quality Gate Status value" + run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}" + + From aa19b63a79a1650496044acb61d54f0ec10f494a Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 14:28:39 +0530 Subject: [PATCH 26/43] Update about.html --- static/about.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/about.html b/static/about.html index ed42384e4..06cc055f6 100644 --- a/static/about.html +++ b/static/about.html @@ -64,7 +64,7 @@

About the Author

-

Hi Everyone, My name is John and welcome to my channel :)

+

Hi Everyone, My name is John and welcome to my academy :)

I am an opensource enthusiast and a great believer in sharing knowledge.

I have my footprints in popular opensource projects like Argo CD, Argo CD Operator, Argo Rollouts Manager, GitOps Operator, F5 Ingress Controller, Nginx Ingress Controller by Nginx and others.

From e5791bc5aede39e5aae271cd06ec3b45c9f9c57e Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 14:42:13 +0530 Subject: [PATCH 27/43] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa76c378d..117774e7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: args: > -Dsonar.organization=niteshops-github-action -Dsonar.projectKey=GO-Web-Application + -Dsonar.qualitygate.wait=true env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} From 1630b8250e07d7956381e4cbd7b4d1db97abcd0f Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 14:48:05 +0530 Subject: [PATCH 28/43] Update ci.yml --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 117774e7d..8d8e4808a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,12 @@ jobs: - name: Print GITHUB_WORKSPACE run: echo ${GITHUB_WORKSPACE} + + - name: Print all files + run: | + cd ${GITHUB_WORKSPACE} + pwd + ls -latr # Check the Quality Gate status. - name: SonarQube Quality Gate check id: sonarqube-quality-gate-check From f2a039ac2e505d94fd263af20b1276486fe2da5f Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 14:52:50 +0530 Subject: [PATCH 29/43] Update ci.yml --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d8e4808a..36c2b99be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,9 @@ jobs: cd ${GITHUB_WORKSPACE} pwd ls -latr + cat $GITHUB_ACTION_PATH/script/check-quality-gate.sh + ls -latr $GITHUB_ACTION_PATH/script/ + ls -latr $GITHUB_ACTION_PATH/ # Check the Quality Gate status. - name: SonarQube Quality Gate check id: sonarqube-quality-gate-check From 3b624ea287a105f7a796218f2eacb1c4b6a56ddc Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 14:56:55 +0530 Subject: [PATCH 30/43] Update ci.yml --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36c2b99be..d5be11a9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,6 @@ jobs: cd ${GITHUB_WORKSPACE} pwd ls -latr - cat $GITHUB_ACTION_PATH/script/check-quality-gate.sh ls -latr $GITHUB_ACTION_PATH/script/ ls -latr $GITHUB_ACTION_PATH/ # Check the Quality Gate status. @@ -75,6 +74,11 @@ jobs: uses: sonarsource/sonarqube-quality-gate-action@master with: pollingTimeoutSec: 600 + projectBaseDir: /home/runner/work/go-web-app/go-web-app + args: > + -Dsonar.organization=niteshops-github-action + -Dsonar.projectKey=GO-Web-Application + -Dsonar.qualitygate.wait=true env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} #OPTIONAL From bc8d441f14e269542467164ba25f71174a64c71e Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 15:00:24 +0530 Subject: [PATCH 31/43] Update ci.yml --- .github/workflows/ci.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5be11a9d..0a34eb5b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,13 +61,6 @@ jobs: - name: Print GITHUB_WORKSPACE run: echo ${GITHUB_WORKSPACE} - - name: Print all files - run: | - cd ${GITHUB_WORKSPACE} - pwd - ls -latr - ls -latr $GITHUB_ACTION_PATH/script/ - ls -latr $GITHUB_ACTION_PATH/ # Check the Quality Gate status. - name: SonarQube Quality Gate check id: sonarqube-quality-gate-check From 71f98b3a0d40cab2e9a2ecf283a053bb8b04d1b7 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 15:11:31 +0530 Subject: [PATCH 32/43] Update ci.yml --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a34eb5b7..2f2bf4b06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,6 +61,10 @@ jobs: - name: Print GITHUB_WORKSPACE run: echo ${GITHUB_WORKSPACE} + - name: Print Github Action Dir + run: | + ls -latr $GITHUB_ACTION_PATH/ + # Check the Quality Gate status. - name: SonarQube Quality Gate check id: sonarqube-quality-gate-check From 9577f82fece4541d79c193a73b56cfb3dbe8c569 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 15:20:01 +0530 Subject: [PATCH 33/43] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f2bf4b06..e7f8ee73d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,7 @@ jobs: - name: Print Github Action Dir run: | ls -latr $GITHUB_ACTION_PATH/ + tree $GITHUB_ACTION_PATH/ # Check the Quality Gate status. - name: SonarQube Quality Gate check From be379c1c7850c665ba5ed0e20057dfee2cbf55df Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 15:31:06 +0530 Subject: [PATCH 34/43] Update ci.yml --- .github/workflows/ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7f8ee73d..18e4b39e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,6 @@ jobs: - name: Print Github Action Dir run: | ls -latr $GITHUB_ACTION_PATH/ - tree $GITHUB_ACTION_PATH/ # Check the Quality Gate status. - name: SonarQube Quality Gate check @@ -72,11 +71,7 @@ jobs: uses: sonarsource/sonarqube-quality-gate-action@master with: pollingTimeoutSec: 600 - projectBaseDir: /home/runner/work/go-web-app/go-web-app - args: > - -Dsonar.organization=niteshops-github-action - -Dsonar.projectKey=GO-Web-Application - -Dsonar.qualitygate.wait=true + scanMetadataReportFile: .scannerwork/report-task.txt env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} #OPTIONAL From e5ca2bd7353e69728a1f7a434046b2d9adce173e Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 15:35:25 +0530 Subject: [PATCH 35/43] Update ci.yml --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18e4b39e3..58d19403e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,7 @@ jobs: - name: Print GITHUB_WORKSPACE run: echo ${GITHUB_WORKSPACE} + - name: Sonarqube Scan uses: SonarSource/sonarqube-scan-action@v4 @@ -50,6 +51,12 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + + + - name: Print GITHUB Actions + run: | + ls -latr ${GITHUB_ACTION_PATH} + find ${GITHUB_ACTION_PATH}/ -name "report-task.txt" sonarqube-quality-gate-check: needs: [build,sonarqube-analysis] From 54c7cbbfa328ec83fca5fdefe364d14e99247cf3 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 15:41:23 +0530 Subject: [PATCH 36/43] Update ci.yml sonarqube analysis and quality quates --- .github/workflows/ci.yml | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58d19403e..c65c5e776 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: - "README.md" jobs: - build: + build-and-test: runs-on: ubuntu-latest steps: - name: Checkout code @@ -29,8 +29,8 @@ jobs: - name: Run tests run: go test ./... - sonarqube-analysis: - needs: [build] + sonarqube-analysis-and-quality-check: + needs: [build-and-test] runs-on: ubuntu-latest steps: - name: Checkout code @@ -53,25 +53,6 @@ jobs: SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - - name: Print GITHUB Actions - run: | - ls -latr ${GITHUB_ACTION_PATH} - find ${GITHUB_ACTION_PATH}/ -name "report-task.txt" - - sonarqube-quality-gate-check: - needs: [build,sonarqube-analysis] - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Print GITHUB_WORKSPACE - run: echo ${GITHUB_WORKSPACE} - - - name: Print Github Action Dir - run: | - ls -latr $GITHUB_ACTION_PATH/ - # Check the Quality Gate status. - name: SonarQube Quality Gate check id: sonarqube-quality-gate-check From 4eee83c7a85ee6d9f61e0db0b6d64059f7560eb5 Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 15:51:31 +0530 Subject: [PATCH 37/43] Update ci.yml added golang linter --- .github/workflows/ci.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c65c5e776..cbd13e735 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,19 @@ jobs: - name: Run tests run: go test ./... + + code-quality: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Golang Lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.56.2 + + sonarqube-analysis-and-quality-check: needs: [build-and-test] From 4075efa5e0d0c62a1e621457515a9d15b1a1683d Mon Sep 17 00:00:00 2001 From: niteshops Date: Fri, 4 Apr 2025 15:52:58 +0530 Subject: [PATCH 38/43] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbd13e735..028dadaf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,7 @@ jobs: run: go test ./... code-quality: + needs: [build-and-test] runs-on: ubuntu-latest steps: - name: Checkout code From 0d13ab061c79b186ee8a3cbb0e010162df3690b9 Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Fri, 4 Apr 2025 16:37:47 +0530 Subject: [PATCH 39/43] added git tag update , build image and push to docker hub --- .github/workflows/ci.yml | 54 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 028dadaf8..003dafaa2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,5 +82,57 @@ jobs: # The possible outputs of the `quality-gate-status` variable are `PASSED`, `WARN` or `FAILED`. - name: "Example show SonarQube Quality Gate Status value" run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}" + + build-docker-img-and-push: + needs: sonarqube-analysis-and-quality-check + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + # Add support for more platforms with QEMU (optional) + # https://github.com/docker/setup-qemu-action + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up docker Buildx + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64,linux/arm64 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Push action + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/go-web-app:${{github.run_id}} - + update-image-tag-in-helm-chart: + runs-on: ubuntu-latest + needs: build-docker-img-and-push + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.TOKEN }} + + - name: Update image tag in Helm chart + run: | + echo "Updating image tag in Helm chart" + sed -i "s|image:.*|image: ${{ secrets.DOCKERHUB_USERNAME }}/go-web-app:${{github.run_id}}|g" helm/go-web-app/values.yaml + cat helm/go-web-app/values.yaml + echo "Image tag updated in Helm chart" + + - name: Commit and push changes + run: | + git config --global user.email "niteshwayafalkar@gmail.com" + git config --global user.name "Nitesh Wayafalkar" + git add helm/go-web-app-chart/values.yaml + git commit -m "Update tag in Helm chart" + git push \ No newline at end of file From 6a8fec599ddd445bb2166d981e7ed677cba9d89e Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Fri, 4 Apr 2025 16:43:53 +0530 Subject: [PATCH 40/43] vars.DOCKERHUB_USERNAME --- .github/workflows/ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 003dafaa2..c797cb628 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,17 +29,17 @@ jobs: - name: Run tests run: go test ./... - code-quality: - needs: [build-and-test] - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Run Golang Lint - uses: golangci/golangci-lint-action@v6 - with: - version: v1.56.2 + #code-quality: + #needs: [build-and-test] + #runs-on: ubuntu-latest + #steps: + # - name: Checkout code + # uses: actions/checkout@v4 + + #- name: Run Golang Lint + # uses: golangci/golangci-lint-action@v6 + #with: + # version: v1.56.2 @@ -111,7 +111,7 @@ jobs: context: . file: ./Dockerfile push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/go-web-app:${{github.run_id}} + tags: ${{ vars.DOCKERHUB_USERNAME }}/go-web-app:${{github.run_id}} update-image-tag-in-helm-chart: runs-on: ubuntu-latest @@ -125,7 +125,7 @@ jobs: - name: Update image tag in Helm chart run: | echo "Updating image tag in Helm chart" - sed -i "s|image:.*|image: ${{ secrets.DOCKERHUB_USERNAME }}/go-web-app:${{github.run_id}}|g" helm/go-web-app/values.yaml + sed -i 's/tag: .*/tag: "${{github.run_id}}"/' helm/go-web-app-chart/values.yaml cat helm/go-web-app/values.yaml echo "Image tag updated in Helm chart" From 6827652d576df5ad6dbf59bc1d4bd7551e9e1313 Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Fri, 4 Apr 2025 16:49:11 +0530 Subject: [PATCH 41/43] Fixed:- FromAsCasing: 'as' and 'FROM' keywords' casing do not match --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3a49dc63e..525cc8866 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.5 as base +FROM golang:1.22.5 AS base WORKDIR /app From 364f6b6bfc82d7cf63611f43315314787b69b913 Mon Sep 17 00:00:00 2001 From: Nitesh Wayafalkar Date: Fri, 4 Apr 2025 16:54:13 +0530 Subject: [PATCH 42/43] Fixed: go package downloader --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 525cc8866..84a0a53b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /app COPY go.mod ./ -RUN go mod download +RUN go mod tidy && go mod vendor COPY . . From bdaf258a411f34549c430c45d02c4814822f0e19 Mon Sep 17 00:00:00 2001 From: niteshwayafalkar Date: Tue, 8 Apr 2025 18:30:29 +0000 Subject: [PATCH 43/43] added orject to idx --- .idx/dev.nix | 61 ++++++++++++++++++++++++++++++++++++++++++ .idx/integrations.json | 3 +++ .vscode/settings.json | 4 +++ 3 files changed, 68 insertions(+) create mode 100644 .idx/dev.nix create mode 100644 .idx/integrations.json create mode 100644 .vscode/settings.json diff --git a/.idx/dev.nix b/.idx/dev.nix new file mode 100644 index 000000000..e6b7d8aaa --- /dev/null +++ b/.idx/dev.nix @@ -0,0 +1,61 @@ +# To learn more about how to use Nix to configure your environment +# see: https://developers.google.com/idx/guides/customize-idx-env +{ pkgs, ... }: { + # Which nixpkgs channel to use. + channel = "stable-24.05"; # or "unstable" + + # Use https://search.nixos.org/packages to find packages + packages = [ + pkgs.go + # pkgs.python311 + # pkgs.python311Packages.pip + # pkgs.nodejs_20 + # pkgs.nodePackages.nodemon + pkgs.docker-buildx + pkgs.docker + pkgs.kubernetes + pkgs.helm + pkgs.kubernetes-helm + pkgs.javaPackages.openjfx17 + ]; + + # Sets environment variables in the workspace + env = {}; + idx = { + # Search for the extensions you want on https://open-vsx.org/ and use "publisher.id" + extensions = [ + # "vscodevim.vim" + ]; + + # Enable previews + previews = { + enable = true; + previews = { + # web = { + # # Example: run "npm run dev" with PORT set to IDX's defined port for previews, + # # and show it in IDX's web preview panel + # command = ["npm" "run" "dev"]; + # manager = "web"; + # env = { + # # Environment variables to set for your server + # PORT = "$PORT"; + # }; + # }; + }; + }; + + # Workspace lifecycle hooks + workspace = { + # Runs when a workspace is first created + onCreate = { + # Example: install JS dependencies from NPM + # npm-install = "npm install"; + }; + # Runs when the workspace is (re)started + onStart = { + # Example: start a background task to watch and re-build backend code + # watch-backend = "npm run watch-backend"; + }; + }; + }; +} diff --git a/.idx/integrations.json b/.idx/integrations.json new file mode 100644 index 000000000..9b90d3354 --- /dev/null +++ b/.idx/integrations.json @@ -0,0 +1,3 @@ +{ + "cloud_run_deploy": {} +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..03adc8d20 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "IDX.aI.enableInlineCompletion": true, + "IDX.aI.enableCodebaseIndexing": true +} \ No newline at end of file