jenkins

yum

wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum upgrade
yum install jenkins java-1.8.0-openjdk-devel

rpm -qil jenkins
Name        : jenkins
Version     : 2.263.1
Release     : 1.1
Architecture: noarch
Install Date: Thu Dec 10 03:51:14 2020
Group       : Development/Tools/Building
Size        : 67280943
License     : MIT/X License, GPL/CDDL, ASL2
Signature   : RSA/SHA512, Wed Dec  2 13:56:53 2020, Key ID fcef32e745f2c3d5
Source RPM  : jenkins-2.263.1-1.1.src.rpm
Build Date  : Wed Dec  2 13:56:11 2020
Build Host  : package-linux-2pxth-zrwjc
Relocations : (not relocatable)
URL         : http://jenkins.io/
Summary     : Jenkins Automation Server
Description :
Jenkins is an open source automation server which enables developers around the world to reliably automate  their development lifecycle processes of all kinds, including build, document, test, package, stage, deployment, static analysis and many more.

Jenkins is being widely used in areas of Continous Integration, Continuous Delivery, DevOps, and other areas. And it is not only about software, the same automation techniques can be applied in other areas like Hardware Engineering, Embedded Systems, BioTech, etc.

For information see https://jenkins.io


Authors:
--------
    Kohsuke Kawaguchi <kk@kohsuke.org>
/etc/init.d/jenkins
/etc/logrotate.d/jenkins
/etc/sysconfig/jenkins
/usr/lib/jenkins
/usr/lib/jenkins/jenkins.war
/usr/sbin/rcjenkins
/var/cache/jenkins
/var/lib/jenkins
/var/log/jenkins

jar

wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war

### jar方式启动
java \
-server -Xms2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Djava.security.egd=file:/dev/./urandom \
-DJENKINS_HOME=/data/.jenkins \
-Dhudson.udp=-1 \
-Dhudson.DNSMultiCast.disabled=true \
-jar jenkins.war --httpPort=8090


####
-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-5247006010869253587, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -Dio.netty.allocator.type=unpooled, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/usr/local/src/elasticsearch, -Des.path.conf=/usr/local/src/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true
####

#### Options
Running from: /data/jenkins.war
webroot: System.getProperty("JENKINS_HOME")
Jenkins Automation Server Engine 2.204.1
Usage: java -jar jenkins.war [--option=value] [--option=value]

Options:
   --webroot                = folder where the WAR file is expanded into. Default is ${JENKINS_HOME}/war
   --pluginroot             = folder where the plugin archives are expanded into. Default is ${JENKINS_HOME}/plugins
                              (NOTE: this option does not change the directory where the plugin archives are stored)
   --extractedFilesFolder   = folder where extracted files are to be located. Default is the temp folder
   --daemon                 = fork into background and run as daemon (Unix only)
   --logfile                = redirect log messages to this file
   --enable-future-java     = allows running with new Java versions which are not fully supported (class version 52 and above)
   --javaHome               = Override the JAVA_HOME variable
   --toolsJar               = The location of tools.jar. Default is JAVA_HOME/lib/tools.jar
   --config                 = load configuration properties from here. Default is ./winstone.properties
   --prefix                 = add this prefix to all URLs (eg http://localhost:8080/prefix/resource). Default is none
   --commonLibFolder        = folder for additional jar files. Default is ./lib

   --extraLibFolder         = folder for additional jar files to add to Jetty classloader

   --logThrowingLineNo      = show the line no that logged the message (slow). Default is false
   --logThrowingThread      = show the thread that logged the message. Default is false
   --debug                  = set the level of debug msgs (1-9). Default is 5 (INFO level)

   --httpPort               = set the http listening port. -1 to disable, Default is 8080
   --httpListenAddress      = set the http listening address. Default is all interfaces
   --httpKeepAliveTimeout   = how long idle HTTP keep-alive connections are kept around (in ms; default 5000)?
   --httpsPort              = set the https listening port. -1 to disable, Default is disabled
   --httpsListenAddress     = set the https listening address. Default is all interfaces
   --httpsKeepAliveTimeout  = how long idle HTTPS keep-alive connections are kept around (in ms; default 5000)?
   --httpsKeyStore          = the location of the SSL KeyStore file. Default is ./winstone.ks
   --httpsKeyStorePassword  = the password for the SSL KeyStore file. Default is null
   --httpsKeyManagerType    = the SSL KeyManagerFactory type (eg SunX509, IbmX509). Default is SunX509
   --httpsPrivateKey        = this switch with --httpsCertificate can be used to run HTTPS with OpenSSL secret key
     / --httpsCertificate     file and the corresponding certificate file
   --http2Port              = set the http2 listening port. -1 to disable, Default is disabled
   --http2ListenAddress     = set the http2 listening address. Default is all interfaces
   --excludeCipherSuites    = set the ciphers to exclude (comma separated, use blank quote " " to exclude none) (default is
                           // Exclude weak / insecure ciphers
                           "^.*_(MD5|SHA|SHA1)$",
                           // Exclude ciphers that don't support forward secrecy
                           "^TLS_RSA_.*$",
                           // The following exclusions are present to cleanup known bad cipher
                           // suites that may be accidentally included via include patterns.
                           // The default enabled cipher list in Java will not include these
                           // (but they are available in the supported list).
                           "^SSL_.*$",
                           "^.*_NULL_.*$",
                           "^.*_anon_.*$"
   --controlPort            = set the shutdown/control port. -1 to disable, Default disabled

   --useJasper              = enable jasper JSP handling (true/false). Default is false
   --sessionTimeout         = set the http session timeout value in minutes. Default to what webapp specifies, and then to 60 minutes
   --sessionEviction        = set the session eviction timeout for idle sessions in seconds. Default value is 180. -1 never evict, 0 evict on exit
   --mimeTypes=ARG          = define additional MIME type mappings. ARG would be EXT=MIMETYPE:EXT=MIMETYPE:...
                              (e.g., xls=application/vnd.ms-excel:wmf=application/x-msmetafile)
   --maxParamCount=N        = set the max number of parameters allowed in a form submission to protect
                              against hash DoS attack (oCERT #2011-003). Default is 10000.
   --useJmx                 = Enable Jetty Jmx
   --qtpMaxThreadsCount     = max threads number when using Jetty Queued Thread Pool
   --jettyAcceptorsCount    = Jetty Acceptors number
   --jettySelectorsCount    = Jetty Selectors number
   --usage / --help         = show this message
 Security options:
   --realmClassName               = Set the realm class to use for user authentication. Defaults to ArgumentsRealm class

   --argumentsRealm.passwd.<user> = Password for user <user>. Only valid for the ArgumentsRealm realm class
   --argumentsRealm.roles.<user>  = Roles for user <user> (comma separated). Only valid for the ArgumentsRealm realm class

   --fileRealm.configFile         = File containing users/passwds/roles. Only valid for the FileRealm realm class

 Access logging:
   --accessLoggerClassName        = Set the access logger class to use for user authentication. Defaults to disabled
   --simpleAccessLogger.format    = The log format to use. Supports combined/common/resin/custom (SimpleAccessLogger only)
   --simpleAccessLogger.file      = The location pattern for the log file(SimpleAccessLogger only)

docker

docker container run -p 18080:8080 -p 50000:50000 --name jenkins111 -d jenkins/jenkins:2.164.2-alpine
docker container exec -it jenkins111 /bin/bash
docker container stop jenkins111
docker container rm jenkins111
mkdir data
cat > data/log.properties <<EOF
handlers=java.util.logging.ConsoleHandler
jenkins.level=FINEST
java.util.logging.ConsoleHandler.level=FINEST
EOF
docker run --name jenkins667 -p 18080:8080 -p 50000:50000 --env JAVA_OPTS="-Djava.util.logging.config.file=/var/jenkins_home/log.properties" -v `pwd`/data:/var/jenkins_home jenkins/jenkins:lts

k8s

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: jenkins
  namespace: default
  labels:
    k8s-app: jenkins
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: jenkins
        k8s-app: jenkins
    spec:
      #securityContext:
      #  fsGroup: 1000
      #  runAsNonRoot: true        
      containers:
      - name: jenkins
        image: jenkins/jenkins:2.176.1-alpine
        ports:
          - containerPort: 8080
          - containerPort: 50000
        #securityContext:
        #  allowPrivilegeEscalation: false
---
apiVersion: v1
kind: Service
metadata:
  name: jenkins
  namespace: default
  labels:
    k8s-app: jenkins
    kubernetes.io/cluster-service: "true"
spec:
  type: NodePort
  selector:
   k8s-app: jenkins
  ports:
  - port: 8080
    targetPort: 8080
    nodePort: 30015
# 获取admin默认密码
# cat /var/jenkins_home/secrets/initialAdminPassword
kubectl exec -it $(kubectl get pod -l k8s-app=jenkins -o jsonpath={.items[0].metadata.name}) -- /bin/sh -c "cat /var/jenkins_home/secrets/initialAdminPassword"

sonarqube

docker pull sonarqube:7.9.2-community

docker run -it --rm sonarqube:7.9.2-community bash -c "id"
uid=999(sonarqube) gid=999(sonarqube) groups=999(sonarqube)

mkdir -p sonarqube/{conf,data,logs,extensions}

chown -R 999 sonarqube


docker run -it -d --name sonarqube -p 9000:9000 \
-e TZ="Asia/shanghai" \
--user sonarqube \
-v $(pwd)/sonarqube/conf:/opt/sonarqube/conf \
-v $(pwd)/sonarqube/extensions:/opt/sonarqube/extensions \
-v $(pwd)/sonarqube/logs:/opt/sonarqube/logs \
-v $(pwd)/sonarqube/data:/opt/sonarqube/data sonarqube:7.9.2-community

# sonar.properties 重要参数调整
sonar.jdbc.username=
sonar.jdbc.password=
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube?currentSchema=my_schema
sonar.search.javaOpts=-Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError

# 中文汉化
https://github.com/SonarQubeCommunity/sonar-l10n-zh
https://github.com/SonarQubeCommunity/sonar-l10n-zh/releases/download/sonar-l10n-zh-plugin-1.29/sonar-l10n-zh-plugin-1.29.jar



#docker run -itd --name sonarqube-tmp sonarqube:7.9.2-community

#docker cp sonarqube-tmp:/opt/sonarqube/conf $(pwd)/sonarqube
#docker cp sonarqube-tmp:/opt/sonarqube/extensions $(pwd)/sonarqube

#docker stop sonarqube-tmp && docker rm sonarqube-tmp


#docker run -it --rm --name sonarqube -p 9000:9000 \
#--user root \
#-v $(pwd)/sonarqube/conf:/opt/sonarqube/conf \
#-v $(pwd)/sonarqube/extensions:/opt/sonarqube/extensions \
#-v $(pwd)/sonarqube/logs:/opt/sonarqube/logs \
#-v $(pwd)/sonarqube/data:/opt/sonarqube/data sonarqube:7.9.2-community bash -c "chown -R sonarqube.sonarqube /opt/sonarqube/conf && chown -R sonarqube.sonarqube /opt/sonarqube/extensions && chown -R sonarqube.sonarqube /opt/sonarqube/logs && chown -R sonarqube.sonarqube /opt/sonarqube/data"

scm

gitlab

subversion

docker-registry-harbor

nexus3

jfrog

# https://www.ilanni.com/?p=14689
# https://bintray.com/jfrog/artifactory/jfrog-artifactory-oss-zip
docker pull docker.bintray.io/jfrog/artifactory-oss:7.6.1
$ docker run --name artifactory -d -p 8081:8081 docker.bintray.io/jfrog/artifactory-oss:7.6.1
$ docker run --name artifactory -d -p 8081:8081 -e EXTRA_JAVA_OPTIONS='-Xms512m -Xmx2g -Xss256k -XX:+UseG1GC' docker.bintray.io/jfrog/artifactory-pro:7.6.1
# https://www.jfrog.com/confluence/display/RTF6X/Installing+with+Docker#InstallingwithDocker-PullingtheArtifactoryDockerImage

jmeter

./jmeter.sh -n -t ~/Desktop/baidu.jmx -l esult.jtl -e -o /data
An error occurred: Cannot write to '/data' as folder is not empty
./jmeter.sh -n -t ~/Desktop/baidu.jmx -l esult.jtl -R 172.16.20.146:1099
./jmeter.sh -n -t ~/Desktop/baidu.jmx -l /tmp/esult-$RANDOM.jtl -e -o ~/Desktop/222-$RANDOM

参考