-
Notifications
You must be signed in to change notification settings - Fork 83
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
Running together with kubernetes-plugin prevents ANSI Color from working #201
Comments
Thank you for the screenshots, it would be however helpful if you could provide the details as requested in the issue template:
Since you are running this in
Also could you try specifying your agent inside your pipeline like
instead of
and running the same again? |
@tszmytka I think the agent section doesn't matter since all jobs runs in a kubernetes pod. To get a nomral output I just allowed the jenkins leaders to run jobs. Let me know if I want to explicitly do that. Extra info: Jenkins version - The jenkins is running in a standard Amazon EKS cluster. Kubernetes plugin version - Jenkins leader image: |
Maybe it won't but it's worth taking a shot. Please do that if you have the chance. The thing is Just to make sure I've set up a clean environment with:
and the pipeline you provided renders green output. I connected the agent directly (no k8s cluster) but other elements are the same. I noticed that your screenshot shows log output before |
Here's all the plugin's that are installed: - ansicolor:latest
- artifactory:latest
- authorize-project:latest
- configuration-as-code:latest
- envinject:latest
- git:latest
- job-dsl:latest
- kubernetes-credentials-provider:latest
- kubernetes:latest
- pipeline-cps-http:latest
- rebuild:latest
- ssh-agent:latest
- uno-choice:latest
- workflow-aggregator:latest
- workflow-cps-global-lib-http:latest
- workflow-cps-global-lib:latest
- htmlpublisher:latest Here's the complete job output: Started by user admin
Running as admin
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Still waiting to schedule task
Waiting for next available executor
Agent jenkins-agent-bz40t is provisioned from template jenkins-agent
---
apiVersion: "v1"
kind: "Pod"
metadata:
annotations: {}
labels:
jenkins/jenkins-frezbo-jenkins-slave: "true"
jenkins/label: "jenkins-frezbo-jenkins-slavex"
name: "jenkins-agent-bz40t"
spec:
containers:
- command:
- "cat"
env:
- name: "DOCKER_HOST"
value: "tcp://dind:2375"
image: "<redacted>:2.8.18"
imagePullPolicy: "Always"
name: "dev"
securityContext:
runAsUser: 1000
tty: true
volumeMounts:
- mountPath: "/home/ec2-user/.gitconfig"
name: "git-config"
subPath: ".gitconfig"
- mountPath: "/home/ec2-user/.ssh/config"
name: "ssh-config"
subPath: "config"
- mountPath: "/home/ec2-user/.gemrc"
name: "gem-sources"
subPath: ".gemrc"
- mountPath: "/home/ec2-user/.bundle/config"
name: "bundle-config"
subPath: "config"
- mountPath: "/home/jenkins"
name: "workspace-volume"
readOnly: false
workingDir: "/home/jenkins"
- args:
- "********"
- "jenkins-agent-bz40t"
env:
- name: "JENKINS_SECRET"
value: "********"
- name: "JENKINS_TUNNEL"
value: "jenkins-frezbo-agent.frezbo:50000"
- name: "JENKINS_AGENT_NAME"
value: "jenkins-agent-bz40t"
- name: "AGENT_NAME"
value: "dev-env"
- name: "JENKINS_NAME"
value: "jenkins-agent-bz40t"
- name: "JENKINS_AGENT_WORKDIR"
value: "/home/jenkins"
- name: "JENKINS_URL"
value: "http://jenkins-frezbo.frezbo.svc.cluster.local:8080"
image: "<redacted>.<redacted>/jenkins/inbound-agent:4.3-4"
imagePullPolicy: "Always"
name: "jnlp"
resources:
limits:
memory: "512Mi"
cpu: "512m"
requests:
memory: "512Mi"
cpu: "512m"
securityContext:
privileged: false
runAsUser: 1000
tty: false
volumeMounts:
- mountPath: "/home/jenkins"
name: "workspace-volume"
readOnly: false
workingDir: "/home/jenkins"
dnsPolicy: "ClusterFirstWithHostNet"
hostNetwork: true
imagePullSecrets:
- name: "jenkins-frezbo-agent-docker-secret"
nodeSelector:
node-role.kubernetes.io/jenkins-agent: "true"
restartPolicy: "Never"
serviceAccount: "jenkins-frezbo-agent"
volumes:
- configMap:
defaultMode: 420
name: "jenkins-frezbo-git-config"
name: "git-config"
- name: "bundle-config"
secret:
defaultMode: 420
secretName: "jenkins-frezbo-bundle-config"
- name: "gem-sources"
secret:
defaultMode: 420
secretName: "jenkins-frezbo-gem-sources"
- configMap:
defaultMode: 420
name: "jenkins-frezbo-ssh-config"
name: "ssh-config"
- emptyDir:
medium: ""
name: "workspace-volume"
Running on jenkins-agent-bz40t in /home/jenkins/workspace/spock
[Pipeline] {
[Pipeline] ansiColor
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Run)
[Pipeline] echo
�[32mcolored output�[0m
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
|
We are seeing the same issue |
I have the same issue. My environment is; |
@frezbo I would appreciate 2 additional pieces of information:
|
@tszmytka the jenkins is completely configured with JcaSC, should I sent that config file over or do you want the screenshots? I need to spin up a new one, so please be patient. I might not be able to get to it until monday. Thanks for the help. |
Whatever is easier for you. JcaSC config file would also be fine - provided you are not changing anything manually after initial setup ;-) |
The plugins list are the same. This is the jcasc url, the values in jenkins:
systemMessage: "Jenkins"
securityRealm:
local:
allowsSignup: false
users:
- id: "${admin_username}"
password: "${admin_password}"
authorizationStrategy:
loggedInUsersCanDoAnything:
allowAnonymousRead: false
security:
envInject:
enableLoadingFromMaster: false
enablePermissions: true
hideInjectedVars: true
globalJobDslSecurityConfiguration:
useScriptSecurity: true
# eventually we need to use project specific authorization and have the seed jobs run as admin user
queueItemAuthenticator:
authenticators:
- global:
strategy: "triggeringUsersAuthorizationStrategy"
unclassified:
artifactorybuilder:
useCredentialsPlugin: true
artifactoryServers:
- serverId: artifactory
artifactoryUrl: ${artifactory_endpoint}
deployerCredentialsConfig:
credentialsId: "${artifactory_credentials_id}"
overridingCredentials: false
globalLibraries:
libraries:
- defaultVersion: "${jenkins_library_version}"
name: "${jenkins_library_name}"
retriever:
http:
credentialsId: "${artifactory_credentials_id}"
httpURL: "${artifactory_endpoint}/${jenkins_library_artifactory_repo}/${jenkins_library_remote_repo_path}/^$${library.${jenkins_library_name}.version}/${jenkins_library_remote_repo_path}-groovy-^$${library.${jenkins_library_name}.version}.zip"
preemptiveAuth: true
resourceRoot:
url: "${jenkins_assets_url}"
jobs:
- file: /var/jenkins_home/casc_configs/seeds.groovy |
We are seeing the same issue with ansible output on k8s agents sample output
|
Hi, same issue in my Jenkins installation. In Jenkins master (running in Kubernetes as well), ansiColor step works as expected. In a Kubernetes agent, there're control characters like reported above instead of colorized output. |
I finally got to setting up a totally fresh Jenkins instance together with a k8s cluster using the same setup @frezbo provided. This indeed makes logs show raw escape sequences. After digging a bit deeper and comparing different run results it turned out that the reason lies in A fix should be available in the coming days. There is a way to get back colored output immediately though (at least for the time being) - install |
Thanks @tszmytka We have the same issue and I can confirm that the workaround of installing the timestamper-plugin works fine for us. Thanks for that...good to have that til the fix is available! |
I can also confirm the workaround fixes ansible color output. Thanks! |
… for kubernetes plugin. Test integration with timestamper
…tificial NL to allow ansicolor to work despite. Add tests
Here's my simple pipeline DSL:
When run on the leader (I changed the no of executors of leader to 1 for this), I get this output:
Reverting back the executors to zero so that the agent run on Kubernetes pods, this is the build output:
The text was updated successfully, but these errors were encountered: