Skip to content

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
- [ ] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [ ] Ensure that the pull request title represents the desired changelog entry
- [ ] Please describe what you did
- [ ] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [ ] Ensure you have provided tests - that demonstrates feature works or fixes the issue

@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
@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

Development

Successfully merging this pull request may close these issues.

2 participants