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

[JENKINS-71956] Switching YAML serializer to Jackson to support Octal values #1537

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

Dohbedoh
Copy link
Contributor

@Dohbedoh Dohbedoh commented Apr 24, 2024

Amends #1342 and #1503.

Address the octal / decimal (de)serialization inconsistencies by using Jackson. Just proposing a minimalist Serialization utility here to handle the Serialization / Deserialization of a single resource. As anyway we are only managing YAML with single Pod resource here.

Testing done

Tested a pipeline with octal notation:

pipeline {
    agent {
        kubernetes {
            yaml '''
apiVersion: v1
kind: Pod
metadata:
  name: test
  annotations:
    com.cloudbees.sidecar-injector/inject: no
spec:
  containers:
  - name: jnlp
    volumeMounts:
      - name: ca-bundles
        mountPath: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
        subPath: ca-certificates.crt
        subPath: cacerts
  volumes:
    - name: ca-bundles
      configMap:
        defaultMode: 0644
        name: ca-bundles
'''
        }
    }
    stages {
        stage('Main') {
            steps {
                sleep 600
            }
        }
    }
}

And a pipeline with decimal notation:


pipeline {
    agent {
        kubernetes {
            yaml '''
apiVersion: v1
kind: Pod
metadata:
  name: test
  annotations:
    com.cloudbees.sidecar-injector/inject: no
spec:
  containers:
  - name: jnlp
    volumeMounts:
      - name: ca-bundles
        mountPath: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
        subPath: ca-certificates.crt
        subPath: cacerts
  volumes:
    - name: ca-bundles
      configMap:
        defaultMode: 420
        name: ca-bundles
'''
        }
    }
    stages {
        stage('Main') {
            steps {
                sleep 600
            }
        }
    }
}

And validate that in both cases the right permission are applied to the volume.

Submitter checklist

Edit tasklist title
Beta Give feedback Tasklist Submitter checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
    Options
  2. Ensure that the pull request title represents the desired changelog entry
    Options
  3. Please describe what you did
    Options
  4. Link to relevant issues in GitHub or Jira
    Options
  5. Link to relevant pull requests, esp. upstream and downstream changes
    Options
  6. Ensure you have provided tests - that demonstrates feature works or fixes the issue
    Options
Loading

@Dohbedoh Dohbedoh requested a review from a team as a code owner April 24, 2024 05:20
@jglick jglick changed the title [JENKINS-71956] Switching YAML serializer to Jackson to support Octal… [JENKINS-71956] Switching YAML serializer to Jackson to support Octal values Apr 24, 2024
@Vlatombe Vlatombe added the enhancement Improvements label Apr 29, 2024
@Vlatombe Vlatombe merged commit 4017ba2 into jenkinsci:master Apr 29, 2024
6 checks passed
@Dohbedoh Dohbedoh deleted the JENKINS-71956 branch April 30, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements
Projects
None yet
2 participants