Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
sandeepbaldawa
@sandeepbaldawa_twitter
Also been using JCasC and it's awesome so far, thanks for the gr8 work
sandeepbaldawa
@sandeepbaldawa_twitter
Nigel Armstrong
@nigelarmstrong-bc
Can someone here help with my above post to make the config I posed above compatible with JCasC? I'm not familiar enough with Java/Jenkins to know how to refactor this config.
halkeye
@halkeye:g4v.dev
[m]
@nigelarmstrong-bc: you didn't ask a question, you just posted some code, no errors, no what your trying to do, no what it did actually do
Nigel Armstrong
@nigelarmstrong-bc
@halkeye:g4v.dev It appears that JCasC can't pass in JSONObjects. Is there a way to store a JSONObject in JCasC? Or what is the proper way to split up a JSONObject to multiple fields?
halkeye
@halkeye:g4v.dev
[m]
why do you want a json object? why wouldn't you use a map?
or an array, or what other native structures
Nigel Armstrong
@nigelarmstrong-bc
I don't want a JSONObject. I'm just trying to fix this existing plugin that currently uses a JSONObject.
halkeye
@halkeye:g4v.dev
[m]
so when you say "jcasc can't pass in JSONObjects". what values do you have in your yaml? I don't know if it does support it, but info++
Nigel Armstrong
@nigelarmstrong-bc
I had a config like
"jenkins":
  "clouds":
  - "amazonEC2":
      - "ami": "ami-xxx"
        "connectBySSHProcess": true
        "customDeviceMapping": "/dev/sda1=:500:true:gp2"
        "deleteRootOnTermination": true
        "description": "build"
        "hostKeyVerificationStrategy": "CHECK_NEW_HARD"
        "iamInstanceProfile": "arn:aws:iam::xxx:instance-profile/xxx"
        "idleTerminationMinutes": "5"
        "instanceCapStr": "50"
        "labelString": "xxx"
        "maxTotalUses": 1
        "minimumNumberOfInstancesTimeRangeConfig":
          "minimumNoInstancesActiveTimeRangeDays":
            "friday": false
            "monday": true
            "saturday": false
            "sunday": false
            "thrusday": true
            "tuesday": true
            "wednesday": true
        "minimumNumberOfSpareInstances": 0
        "mode": "EXCLUSIVE"
        "monitoring": false
        "numExecutors": 1
        "remoteAdmin": "ubuntu"
        "remoteFS": "./jenkins-agent"
        "securityGroups": "sg-xxx"
        "subnetId": "subnet-xxx"
        "tags":
        - "name": "Name"
          "value": "xxx"
        - "name": "jenkins_label"
          "value": "xxx"
        "type": "M54xlarge"
But JCasC doesn't find the attribute that uses JSONObject,
2021-04-02 20:23:58.530+0000 [id=5604]    WARNING    h.i.i.InstallUncaughtExceptionHandler#handleException: Caught unhandled exception with ID 899a19e6-cf5e-45dd-8ee5-34aeeda6e1d2
io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class hudson.plugins.ec2.util.MinimumNumberOfInstancesTimeRangeConfig : minimumNoInstancesActiveTimeRangeDays.
Available attributes : minimumNoInstancesActiveTimeRangeFrom, minimumNoInstancesActiveTimeRangeTo
    at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:376)
    at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:365)
    at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:276)
    at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:83)
    at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:352)
    at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:276)
    at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:83)
    at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:152)
    at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:77)
    at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:267)
    at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:83)
    at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:277)
    at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:247)
    at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:277)
    at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$2(HeteroDescribableConfigurator.java:86)
    at io.vavr.control.Option.map(Option.java:392)
    at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:86)
    at io.vavr.Tuple2.apply(Tuple2.java:238)
    at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:83)
    at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.check(HeteroDescribableConfigurator.java:92)
    at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.check(HeteroDescribableConfigurator.java:55)
    at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:344)
    at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:287)
    at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$8(ConfigurationAsCode.java:753)
    at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:689)
halkeye
@halkeye:g4v.dev
[m]
I mean that kinda makes sense, thats yaml not json
What if you make another setter that takes in a generic map instead of json?
Nigel Armstrong
@nigelarmstrong-bc
So, seems like JCasC has decided not to support maps, so simply changing to a map does not work
Logged as minimumNoInstancesActiveTimeRangeDays is a Map<?,?>. We decided not to support Maps.
Nigel Armstrong
@nigelarmstrong-bc
Is there some other way to make this work other than breaking this config into another class?
halkeye
@halkeye:g4v.dev
[m]
outside my skillset sorry. I think for jcasc most devs review issues not chat, but i don't know
i.e needs to be descibeable object
Hamza aziz
@Hamza-Aziz
Hi, can you please recommend me some resources to learn jCasC !!
Tim Jacomb
@timja
Hamza aziz
@Hamza-Aziz
thanks
sandeepbaldawa
@sandeepbaldawa_twitter
Is there a way to configure(disable/remove) healthmetrics(weather icon) using Jenkins Configuration-as-Code plugin. Thanks!
Martin d'Anjou
@martinda
Where do I reset/erase the "A URL pointing to a file served on the web." It is stuck on a URL that does not exist anymore.
Tim Jacomb
@timja
there's an xml file on the file system
something...ConfigurationAsCode.xml
grep for your missing url
Martin d'Anjou
@martinda
I deleted the file.
vaddhi raghunath
@vraghun

Hello, I am trying to configure active directory plugin with jcasc with helm ... is there a way to pass the values to the values. yaml instead of providing the secrets directly in values.yaml file :

securityRealm: |
activeDirectory:
domains:

      - name: "XXXXXXXX"
        servers: "xxxxxxxxx"
        site: "site"
        bindName: "xxxxxx"
        bindPassword: "xxxxxxxxxxxxxx"
        tlsConfiguration: TRUST_ALL_CERTIFICATES
12 replies
halkeye
@halkeye:g4v.dev
[m]
@vraghun: you can use env variables (so like ${FOOBAR}) and i think the helm chart can let you populate env variables from secrets
3 replies
Karim El Tel
@KarimElTel_twitter
hello, i want to automate the Configuration Reload by creating a jenkins groovy job that does that. However, after generating a job that contains the line ""ConfigurationAsCode.get().configure()" something strange is happening for me, all the views are disappear (without even running that job) any idea?
Ross Crawford-d'Heureuse
@rosscdh
Hi there, question regarding the JcasC saml plugin and setting the IdP Metadata XML.. how is this configured in the JCasc plugin? the exmaples show no holder for the xml?
Tim Jacomb
@timja
just configure it and export it
(personally I use the remote URL the metadata)
2 replies
ciexample
@ciexample
Hi Guys, can I use OS level Environment variables within my JCASC yaml?
Guillaume Dupin
@yogeek
Hello :) Is this ticket waiting for some actions from the plugin developer ?
https://issues.jenkins.io/browse/JENKINS-64816
Mark Waite
@MarkEWaite
@yogeek I'm not sure I understand the question. Yes, all the issues on issues.jenkins.io that aren't being actively worked are waiting for actions from someone. That someone could be the plugin maintainer, it could be an interested user, it could be someone whose company funds them to develop functionality based on the needs of that team. Can you further clarify your question or the expectations behind the question?
Guillaume Dupin
@yogeek
Yes sorry if it was not clear enough. What I wanted to know was if the work to do was on the "preventive monitoring node" plugin code side or on CasC side.
in order to look at the right place to know what would have to be done to achieve the integration
Mark Waite
@MarkEWaite
Usually the work needs to be done on the other side, not on the CasC side. In that case, the "other side" may be Jenkins core or it may be a plugin.
Guillaume Dupin
@yogeek
ok so as long as the "other side" plugin code respects the "guidelines", the compatibility with CasC is seemless right ?
Mark Waite
@MarkEWaite
That's correct as far as I understand it
Guillaume Dupin
@yogeek
ok thank you for the clarification @MarkEWaite :)
vaddhi raghunath
@vraghun

HI ... I am trying to configure ad plugin with jcasc code with helm charts
I made values.yaml as below :
JCasC:
defaultConfig: true
configScripts:
welcome-message: |
jenkins:
systemMessage: Welcome to our CI\CD server. This Jenkins is configured and managed 'as code' s
securityRealm: ${filename}

and. my secret.yaml looks like this :
apiVersion: v1
kind: Secret
metadata:
name: adserver
namespace: {{ template "jenkins.namespace" . }}
type: Opaque
data:
filename: {{ "fAgICAgYmluZFBhc3N3b3JkOiAiY2hhMnBoZWV2LmFoUjlxdWVlMUFvc2gycGFqb281SWIiCiAgICAggICAgICAgIHJlbW92ZUlycmVsZXZhbnRHcm91cHM6IHRydWUKICAgICAgICBjdXN0b21Eb21haW46IHRydWUKICAgICAgICBjYWNoZToKICAgICAgICAgIHNpemU6IDI1MAogICAgICAgICAgdHRsOiAxMAogICAgICAgIHN0YXJ0VGxzOiBmYWxzZQogICAgICAgIGludGVybmFsVXNlcnNEYXRhYmFzZToKICAgICAgICAgIGplbmtpbnNJbnRlcm5hbFVzZXI6ICJqZW5raW5zIg==" }}

but still my controller not like this set up .. .. when exec to the jenkins-controller ..... I could see this :
jenkins@jenkins-test2-0:/run/secrets/adserver$ cat /var/jenkins_home/casc_configs/jcasc-default-config.yaml
jenkins:
authorizationStrategy:
loggedInUsersCanDoAnything:
allowAnonymousRead: true
securityRealm:
${filename}
itr suppose to be my values which I gave in secret.yaml file right ?? Could someone please help me out.. early response is appreciable ... Thanks!!

Slaus Blinnikov
@SlausB
Hello! I run Jenkins inside docker container locally. Is it possible to automatically login as admin by default?
My current jCasC.yaml is:
jenkins:
  securityRealm:
    local:
      allowsSignup: false
      users:
       - id: admin
         password: admin
  authorizationStrategy: loggedInUsersCanDoAnything
halkeye
@halkeye:g4v.dev
[m]
@SlausB: when you say by default, do you mean issue a login cookie to a random browser? You can disable logins so everyone is admin
Slaus Blinnikov
@SlausB
@halkeye:g4v.dev yes, I want everyone visiting http://localhost:8080 automatically becoming an admin. How can I disable logins? I tried specifying authorizationStrategy: unsecured, but instead of being admin there is log in button at top-right
halkeye
@halkeye:g4v.dev
[m]

securityRealm: null
authorizationStrategy: Unsecured

According to https://jenkinsci-users.narkive.com/7w1LjCoH/configuration-as-a-code-plugin-securiy-disable but I've never done it so unsure

Slaus Blinnikov
@SlausB

@halkeye:g4v.dev It worked! Thanks! Becoming an admin would probably be slightly more intuitive, but having no labels at rop-right corner is even better ;) And jCasC.yaml is even more concise now:

jenkins:
  securityRealm: null
  authorizationStrategy: unsecured

Btw, I consider local docker jenkins setup without any authentication as secure: developer decrypts his credentials (deploy server keys, GitLab password, etc.) with gpg, runs jenkins locally inside docker, performs builds/deploys, closes container, shreds credentials.yaml. Everything works thankfully to CasC! Jenkins+CasC is cool!

halkeye
@halkeye:g4v.dev
[m]
You do what fits your flow but I'll never consider disabling auth as secure.
huatianyu489
@huatianyu489
I want to return the results to gitlab after the pipeline is over, can anyone provide some help?