Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve testing running on GitHub Actions #95

Closed
wants to merge 4 commits into from
Closed

Improve testing running on GitHub Actions #95

wants to merge 4 commits into from

Conversation

itskingori
Copy link

@itskingori itskingori commented Nov 13, 2024

Summary

I see an opportunity to improve the tests running GitHub Actions. I would like to start with test part, then I can follow up with the release part.

Improvements

  • Add linting test to test workflow
  • Add Docker build test to test workflow
  • Add code annotations based of using Go test results
  • Configure go version in tests from the go.mod file
  • Configure go setup cache key from go.sum hash

Reviewing

Follow the commits, each commit is an idea.

Checklist

  • Tested and/or added tests to validate that the changes work as intended, if applicable.
  • Updated documentation in README.md, if applicable.

References

@itskingori itskingori changed the title Improve GitHub Actions Improve tests running on GitHub Actions Nov 13, 2024
@itskingori itskingori marked this pull request as ready for review November 13, 2024 10:24
@itskingori itskingori changed the title Improve tests running on GitHub Actions Improve testing running on GitHub Actions Nov 13, 2024
@itskingori
Copy link
Author

I see an opportunity to improve the tests running GitHub Actions. I would like to start with test part, then I can follow up with the release part.

My ultimate goal was to update the CI to fix an issue running this tool on ARM based instances i.e.

$ kubectl logs -f pod/k8s-ttl-controller-6897978d46-mmkwc -n addons
exec /k8s-ttl-controller: exec format error

I should have probably started with filing an issue to check if you're accepting PRs (or confirm scope of the work). Since, this is a blocking issue, so I'll close and package it on my own as Intellection/docker-k8s-ttl-controller.

@TwiN
Copy link
Owner

TwiN commented Nov 20, 2024

fix an issue running this tool on ARM based instances

There is a docker image for ARM btw

platforms: linux/amd64,linux/arm64

@itskingori
Copy link
Author

I know, and I tried using it at first but it doesn't work ... and the error it gives the hint that it's architecture related.

$ kubectl describe deployment.apps/k8s-ttl-controller -n addons
Name:                   k8s-ttl-controller
Namespace:              addons
CreationTimestamp:      Tue, 19 Nov 2024 16:50:50 +0200
Labels:                 app=k8s-ttl-controller
Annotations:            deployment.kubernetes.io/revision: 3
Selector:               app=k8s-ttl-controller
Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:           app=k8s-ttl-controller
  Service Account:  k8s-ttl-controller
  Containers:
   k8s-ttl-controller:
    Image:      ghcr.io/twin/k8s-ttl-controller:v1.2.0
    Port:       <none>
    Host Port:  <none>
    Limits:
      cpu:     32m
      memory:  256Mi
    Requests:
      cpu:        16m
      memory:     128Mi
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Progressing    True    NewReplicaSetAvailable
  Available      False   MinimumReplicasUnavailable
OldReplicaSets:  k8s-ttl-controller-6c494f67cb (0/0 replicas created), k8s-ttl-controller-7fdbdfbccb (0/0 replicas created)
NewReplicaSet:   k8s-ttl-controller-6d679ffddb (1/1 replicas created)
Events:
  Type    Reason             Age    From                   Message
  ----    ------             ----   ----                   -------
  Normal  ScalingReplicaSet  18s    deployment-controller  Scaled up replica set k8s-ttl-controller-6d679ffddb to 1 from 0

$ kubectl get Deployment,Pod -l app=k8s-ttl-controller -n addons
NAME                                 READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/k8s-ttl-controller   0/1     1            0           13h

NAME                                      READY   STATUS   RESTARTS      AGE
pod/k8s-ttl-controller-6d679ffddb-2sn4w   0/1     Error    3 (29s ago)   49s

$ kubectl logs -f pod/k8s-ttl-controller-6d679ffddb-2sn4w -n addons
exec /k8s-ttl-controller: exec format error

@itskingori
Copy link
Author

Figured I'd submit improvements piece by piece, starting with the tests ... as I think there's something wrong with the ARM release. Tried to inspect your image and you can see I can't even tell what arch's are available ...

$ docker buildx imagetools inspect ghcr.io/twin/k8s-ttl-controller:v1.2.0
Name:      ghcr.io/twin/k8s-ttl-controller:v1.2.0
MediaType: application/vnd.docker.distribution.manifest.v2+json
Digest:    sha256:d9ec4b5576d7a6e0c2f72b28a627a88548e3ea86729f7d0bb42d15eca7f3ad7f

$ docker buildx imagetools inspect zappi/k8s-ttl-controller:1.3.1
Name:      docker.io/zappi/k8s-ttl-controller:1.3.1
MediaType: application/vnd.oci.image.index.v1+json
Digest:    sha256:cbbde6760caaebabc2ef6c3491effc86619718b04380c9c610557382589ed752

Manifests:
  Name:        docker.io/zappi/k8s-ttl-controller:1.3.1@sha256:76792844b28dbfec4f38e64c33dcff5d82f52634dca9d44e9c99dc216e256d5b
  MediaType:   application/vnd.oci.image.manifest.v1+json
  Platform:    linux/amd64

  Name:        docker.io/zappi/k8s-ttl-controller:1.3.1@sha256:f4116c85bb350eb4af0e2172b00078bfd9714dac64e69ebcb7f8826aedf4f468
  MediaType:   application/vnd.oci.image.manifest.v1+json
  Platform:    linux/arm64

  Name:        docker.io/zappi/k8s-ttl-controller:1.3.1@sha256:ff61d998d99fd8f034d13e1fb5f986e0e9f7784ba5327cc53fbf2a9af4ce4b53
  MediaType:   application/vnd.oci.image.manifest.v1+json
  Platform:    unknown/unknown
  Annotations:
    vnd.docker.reference.digest: sha256:76792844b28dbfec4f38e64c33dcff5d82f52634dca9d44e9c99dc216e256d5b
    vnd.docker.reference.type:   attestation-manifest

  Name:        docker.io/zappi/k8s-ttl-controller:1.3.1@sha256:29c47952bc16678763f371a49357e2f8d74049f547c7c24297d2e11e2bec67ab
  MediaType:   application/vnd.oci.image.manifest.v1+json
  Platform:    unknown/unknown
  Annotations:
    vnd.docker.reference.type:   attestation-manifest
    vnd.docker.reference.digest: sha256:f4116c85bb350eb4af0e2172b00078bfd9714dac64e69ebcb7f8826aedf4f468

@itskingori
Copy link
Author

Feel free to have a look at the workflows in Intellection/docker-k8s-ttl-controller (and copy if you want, MIT licensed), they pretty much check out the code here and do what I was aiming to do in totality. The exception being I prefer to publish to Docker Hub ... here, had I aimed to publish to both, which is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants