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

chart: incrementals-publisher unit tests for secrets #1077

Merged

Conversation

sarathchandra24
Copy link
Contributor

Unit tests for verifying secrets values and their assignment to deployment env.

I believe this is backward compatible as only the unit tests and values are changes.

helm template incrementals-publisher 

returns the following

---
# Source: incrementals-publisher/templates/secret.yaml
apiVersion: v1
kind: Secret
metadata:
  name: release-name-incrementals-publisher
  labels:
    app.kubernetes.io/name: incrementals-publisher
    helm.sh/chart: incrementals-publisher-0.7.0
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/managed-by: Helm
type: Opaque
data:
  artifactory_key: dGVzdGluZ0FydGlmYWN0b3J5S2V5
  github_token: Y3VzdG9tU3VwZXJTZWNyZXRUb2tlbg==
  github_app_id: Y3VzdG9tU3VwZXJTZWNyZXRBcHBJZA==
  github_app_private_key: Y3VzdG9tU3VwZXJTZWNyZXRQcml2YXRlS2V5
  jenkins_auth: Y3VzdG9tU2VjcmV0SmVua2luc1VzZXI6Y3VzdG9tU2VjcmV0SmVua2luc1Bhc3N3b3Jk
  preshared_key: Y3VzdG9tU3VwZXJTZWNyZXRQcmVTaGFyZWRLZXk=
---
# Source: incrementals-publisher/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: release-name-incrementals-publisher
  labels:
    app.kubernetes.io/name: incrementals-publisher
    helm.sh/chart: incrementals-publisher-0.7.0
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/managed-by: Helm
spec:
  type: ClusterIP
  ports:
    - port: 8080
      targetPort: http
      protocol: TCP
      name: http
  selector:
    app.kubernetes.io/name: incrementals-publisher
    app.kubernetes.io/instance: release-name
---
# Source: incrementals-publisher/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: release-name-incrementals-publisher
  labels:
    app.kubernetes.io/name: incrementals-publisher
    helm.sh/chart: incrementals-publisher-0.7.0
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: incrementals-publisher
      app.kubernetes.io/instance: release-name
  template:
    metadata:
      annotations:
        # subpath secrets don't get updates, and we want to restart on change anyways
        checksum/secret: d1b352b96ce0304125d13f2f6163589249ab793e8c051f8f2ba51347ff19febf
      labels:
        app.kubernetes.io/name: incrementals-publisher
        app.kubernetes.io/instance: release-name
    spec:
      automountServiceAccountToken: false
      securityContext:
        {}
      containers:
        - name: incrementals-publisher
          securityContext:
            {}
          image: "jenkinsciinfra/incrementals-publisher:1.8.10"
          imagePullPolicy: 
          ports:
            - name: http
              containerPort: 3000
              protocol: TCP
          #livenessProbe:
          #  httpGet:
          #    path: /healthcheck
          #    port: http
          #readinessProbe:
          #  httpGet:
          #    path: /healthcheck
          #    port: http
          resources:
            {}
          env:
            - name: JENKINS_AUTH
              valueFrom:
                secretKeyRef:
                  name: release-name-incrementals-publisher
                  key: jenkins_auth
            - name: GITHUB_TOKEN
              valueFrom:
                secretKeyRef:
                  name: release-name-incrementals-publisher
                  key: github_token
            - name: GITHUB_APP_ID
              valueFrom:
                secretKeyRef:
                  name: release-name-incrementals-publisher
                  key: github_app_id
            - name: GITHUB_APP_PRIVATE_KEY
              valueFrom:
                secretKeyRef:
                  name: release-name-incrementals-publisher
                  key: github_app_private_key
            - name: ARTIFACTORY_KEY
              valueFrom:
                secretKeyRef:
                  name: release-name-incrementals-publisher
                  key: artifactory_key
            - name: PRESHARED_KEY
              valueFrom:
                secretKeyRef:
                  name: release-name-incrementals-publisher
                  key: preshared_key

#656

Copy link
Contributor

@dduportal dduportal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sarathchandra24 thanks for this PR.

In order to help maintainers reviewing changes, it is always needed to either:

  • Link to an issue where the problem is described and eventually discussed
  • Or at leas set both the PR title and body to describe the problem you want to solve (e.g. "why did you open this PR?").

I'm blocking this PR because it is not clear which problem do you want to solve (e.g. what is the value of this PR)?

Technically it is neither wrong or right. It might work, or not, but is it justified or needed? And why?


Note: changing the default values of an helm chart is always a breaking change and must be treated as such.

@sarathchandra24
Copy link
Contributor Author

I specified the issue in the comment above at the end. May be it is not visible. Here is the issue to which this PR is linked.
#656

I will forward the discussion to the issue.

@dduportal
Copy link
Contributor

I specified the issue in the comment above at the end. May be it is not visible. Here is the issue to which this PR is linked. #656

I will forward the discussion to the issue.

My apologies, I missed the link to the issue which was the last item in the body. Thanks for the reminder. Let's continue in the issue then!

Copy link
Contributor

@dduportal dduportal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: you might want to take care of following the POSIX rules regarding end of files.

The current git diff shows no empty line at the end of files:

Capture d’écran 2024-02-21 à 09 28 22

See https://thoughtbot.com/blog/no-newline-at-end-of-file to have more informations. Usually you can set your IDE/text editor to automatically add these end of file empty characters

Copy link
Contributor

@dduportal dduportal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new version looks really good!

I've added suggestions (2 are blocking + 1 typo) but it looks almost ready!

charts/incrementals-publisher/values.yaml Outdated Show resolved Hide resolved
charts/incrementals-publisher/tests/defaults_test.yaml Outdated Show resolved Hide resolved
charts/incrementals-publisher/tests/defaults_test.yaml Outdated Show resolved Hide resolved
charts/incrementals-publisher/Chart.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@dduportal dduportal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@dduportal dduportal merged commit da46c21 into jenkins-infra:main Feb 22, 2024
2 checks passed
@sarathchandra24 sarathchandra24 deleted the unit-test-incrementals-publisher branch February 22, 2024 18:02
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