diff --git a/.gitignore b/.gitignore index 89819138f..c98470eef 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ sonarqube_conf jenkins_data postgresql postgresql_data +prometheus_data +grafana_data diff --git a/Jenkinsfile b/Jenkinsfile index 891a7b50d..4832b1158 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { environment { SONARQUBE_URL = 'http://sonarqube:9000' SONARQUBE_CREDENTIALS_ID = 'admin' - GITHUB_TOKEN = credentials('github-token') + GITHUB_TOKEN = $GITHUB_TOKEN } stages { diff --git a/grafana/provisioning/dashboards/dashboard.yml b/grafana/provisioning/dashboards/dashboard.yml new file mode 100644 index 000000000..f4b30782b --- /dev/null +++ b/grafana/provisioning/dashboards/dashboard.yml @@ -0,0 +1,11 @@ +apiVersion: 1 + +providers: + - name: 'default' + orgId: 1 + folder: '' + type: file + disableDeletion: false + editable: true + options: + path: /etc/grafana/provisioning/dashboards diff --git a/jenkins.yaml b/jenkins.yaml index c342f1f19..538f1bbc8 100644 --- a/jenkins.yaml +++ b/jenkins.yaml @@ -1,25 +1,160 @@ -jenkins: - systemMessage: "Jenkins configured by JCasC plugin" - numExecutors: 2 - mode: NORMAL - securityRealm: - local: - allowsSignup: false - users: - - id: "admin" - password: "${JENKINS_ADMIN_PASSWORD}" - credentials: system: domainCredentials: - - credentials: - - usernamePassword: - scope: GLOBAL - id: "github-credentials" - username: "${GITHUB_USERNAME}" - password: "${GITHUB_TOKEN}" - description: "GitHub Credentials" + - credentials: + - string: + description: "github" + id: "3afa055d-73a9-4aff-aa10-9d385042650c" + scope: GLOBAL + secret: $GITHUB_TOKEN +# - string: +# id: "58b57ccb-9fc0-4180-9e6c-91b9df3a6440" +# scope: GLOBAL +# secret: "{AQAAABAAAAAwzL567eZhfHhwsevOonI290HxU4cFwbVCxg7dwlxIglQAiAenE40WxSmN0JnlO4mZoxNk6LWV02LsmfO9ozcsNQ==}" +jenkins: + agentProtocols: + - "JNLP4-connect" + - "Ping" + authorizationStrategy: + loggedInUsersCanDoAnything: + allowAnonymousRead: false + crumbIssuer: + standard: + excludeClientIPFromCrumb: false + disableRememberMe: false + disabledAdministrativeMonitors: + - "jenkins.diagnostics.ControllerExecutorsNoAgents" + - "hudson.util.DoubleLaunchChecker" + labelAtoms: + - name: "built-in" + markupFormatter: "plainText" + mode: NORMAL + myViewsTabBar: "standard" + nodeMonitors: + - "architecture" + - "clock" + - diskSpace: + freeSpaceThreshold: "1GiB" + freeSpaceWarningThreshold: "2GiB" + - "swapSpace" + - tmpSpace: + freeSpaceThreshold: "1GiB" + freeSpaceWarningThreshold: "2GiB" + - "responseTime" + numExecutors: 2 + primaryView: + all: + name: "all" + projectNamingStrategy: "standard" + quietPeriod: 5 + remotingSecurity: + enabled: true + scmCheckoutRetryCount: 0 + securityRealm: + local: + allowsSignup: false + enableCaptcha: false + users: + - id: "admin" + name: "admin" + properties: + - "apiToken" + - "consoleUrlProvider" + - mailer: + emailAddress: "lihanzhan@gmail.com" + - "favorite" + - preferredProvider: + providerId: "default" + - "experimentalFlags" + slaveAgentPort: 50000 + systemMessage: |+ + Jenkins configured automatically by Jenkins Configuration as Code plugin + updateCenter: + sites: + - id: "default" + url: "https://updates.jenkins.io/update-center.json" + views: + - all: + name: "all" + viewsTabBar: "standard" +globalCredentialsConfiguration: + configuration: + providerFilter: "none" + typeFilter: "none" +appearance: + prism: + theme: PRISM +security: + apiToken: + creationOfLegacyTokenEnabled: false + tokenGenerationOnCreationEnabled: false + usageStatisticsEnabled: true + gitHooks: + allowedOnAgents: true + allowedOnController: true + gitHostKeyVerificationConfiguration: + sshHostKeyVerificationStrategy: "knownHostsFileVerificationStrategy" +# sSHD: +# port: -1 + scriptApproval: + approvedSignatures: + - "method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object" unclassified: + bitbucketEndpointConfiguration: + endpoints: + - bitbucketCloudEndpoint: + enableCache: false + manageHooks: false + repositoriesCacheDuration: 0 + teamCacheDuration: 0 + buildDiscarders: + configuredBuildDiscarders: + - "jobBuildDiscarder" + fingerprints: + fingerprintCleanupDisabled: false + storage: "file" + gitHubConfiguration: + apiRateLimitChecker: NoThrottle + gitHubPluginConfig: + hookSecretConfigs: + - credentialsId: "3afa055d-73a9-4aff-aa10-9d385042650c" + hookUrl: "http://localhost:8080/github-webhook/" + junitTestResultStorage: + storage: "file" location: - url: "http://localhost:8081/" + adminAddress: "address not configured yet " + url: "http://localhost:8080/" + mailer: + charset: "UTF-8" + useSsl: false + useTls: false + pollSCM: + pollingThreadCount: 10 + prometheusConfiguration: + appendParamLabel: false + appendStatusLabel: false + collectCodeCoverage: false + collectDiskUsage: true + collectNodeStatus: true + collectingMetricsPeriodInSeconds: 120 + countAbortedBuilds: true + countFailedBuilds: true + countNotBuiltBuilds: true + countSuccessfulBuilds: true + countUnstableBuilds: true + defaultNamespace: "default" + fetchTestResults: true + jobAttributeName: "jenkins_job" + path: "prometheus" + perBuildMetrics: false + processingDisabledBuilds: false + useAuthenticatedEndpoint: false + scmGit: + addGitTagAction: false + allowSecondFetch: false + createAccountBasedOnEmail: false + disableGitToolChooser: false + hideCredentials: false + showEntireCommitSummaryInChanges: false + useExistingAccountWithSameEmail: false diff --git a/prometheus.yml b/prometheus.yml index f7fae4520..a1cf35df0 100644 --- a/prometheus.yml +++ b/prometheus.yml @@ -6,8 +6,8 @@ scrape_configs: metrics_path: '/actuator/prometheus' static_configs: - targets: ['petclinic:8080'] - + - job_name: 'jenkins' metrics_path: '/prometheus' static_configs: - - targets: ['localhost:8081'] \ No newline at end of file + - targets: ['jenkins:8081']