Skip to content

Commit

Permalink
Merge pull request #56 from librecores/librecores-facelift
Browse files Browse the repository at this point in the history
Update the LCCI Docker image to the new packaging flow
  • Loading branch information
oleg-nenashev authored Jun 17, 2019
2 parents 63aa377 + 8446eef commit fe57f5a
Show file tree
Hide file tree
Showing 19 changed files with 571 additions and 611 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
tmp/
target/
.build
Dockerfile
build_cache

# Intellij IDEA
.idea
*.iml

# Visual Studio Code
.vscode
.build
.settings
.project
.classpath
.factorypath
licenses.xml

# Maven code
target
init_scripts/target

# Custom WAR Packager
tmp
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
secrets

# Intellij IDEA
.idea
*.iml

# Visual Studio Code
.vscode
.build
.settings
.project
.classpath
.factorypath
licenses.xml

# Maven code
target
init_scripts/target

# Custom WAR Packager
tmp
25 changes: 21 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
# Contributing

This page is under construction.
Everyone is welcome to contribute to this repository.

## Prerequisites

* Make
* Docker should be installed on the build machine
* Linux or Windows Subsystem for Linux are recommended for building the images
* If you use Windows, see [this page](https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly) for Docker configuration on WSL

## Building and running the developer image

See the makefile in the repository root.
The image can be built with the `make build` command and then launched with `make run`.
Repository buld logic

If you are developing Pipeline libraries or Jenkinsfiles for LibreCores CI,
use the `make dev` command.

## Proposing changes

0. Create pull requests against the master branch
0. System configurations for Jenkins will be promoted to production manually after the merge
1. Create pull requests against the master branch
2. System configurations for Jenkins will be promoted to production manually after the merge

## Troubleshooting

In the case of any questions, please use the <code>#librecores</code> IRC chat on Freenode or create an issue in this project.
In the case of any questions, please use the [librecores/librecores-ci](https://gitter.im/librecores/librecores-ci) gitter chat
or create an issue in this project.
25 changes: 15 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
FROM jenkins/jenkins:2.138.2
#
# Builds the LibreCores CI Server Docker image.
#
FROM librecores/librecores-ci-mvn-cache as mvncache

FROM jenkins/custom-war-packager:pr-104 as builder
COPY --from=mvncache /mavenrepo /mavenrepo
ADD . /lcci-src
WORKDIR /lcci-src
ENV MAVEN_OPTS=-Dmaven.repo.local=/mavenrepo
RUN java -jar /app/custom-war-packager-cli.jar -configPath packager-config.yml

FROM jenkins/jenkins:2.176.1
MAINTAINER Oleg Nenashev <[email protected]>
LABEL Description="Spins up the local development environment" Vendor="Oleg Nenashev" Version="0.1"

#TODO: Get rid of the experimental UC once the FileSystem SCM plugin is released
# Use experimental UC for FileSystem SCM
# See https://github.com/jenkinsci/docker/issues/538
ENV JENKINS_UC_EXPERIMENTAL=https://updates.jenkins.io/experimental
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
COPY install-plugins-2.sh /usr/local/bin/install-plugins-2.sh
RUN /usr/local/bin/install-plugins-2.sh < /usr/share/jenkins/ref/plugins.txt
LABEL Description="Spins up the local development environment" Vendor="FOSSi" Version="0.1"
COPY --from=builder /lcci-src/tmp/output/target/librecores-ci-1.0-SNAPSHOT.war /usr/share/jenkins/jenkins.war

COPY init_scripts/src/main/groovy/ /usr/share/jenkins/ref/init.groovy.d/
COPY userContent ${JENKINS_HOME}/userContent/
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 FOSSi Foundation, Oleg Nenashev
Copyright (c) 2016-2019 FOSSi Foundation, Oleg Nenashev and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 0 additions & 12 deletions LibreCores CI - Jenkins.iml

This file was deleted.

28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
LCCI_IMAGE="librecores/librecores-ci:dev"
CURRENT_HOST?=127.0.0.1

build:
docker build -t ${LCCI_IMAGE} .

run:
docker run --rm -v maven-repo:/root/.m2 \
-e DEV_HOST=${CURRENT_HOST} \
-p 8080:8080 -p 50000:50000 ${LCCI_IMAGE}

dev:
docker run --rm -v maven-repo:/root/.m2 \
-v ${MY_PIPELINE_LIBRARY_DIR}:/var/jenkins_home/pipeline-library \
-v ${MY_OTHER_PIPELINE_LIBS_DIRS}:/var/jenkins_home/pipeline-libs \
-e DEV_HOST=${CURRENT_HOST} \
-p 8080:8080 -p 50000:50000 ${LCCI_IMAGE}

debug:
docker run --rm -e DEBUG=true -p 5005:5005 -v maven-repo:/root/.m2 \
-v ${MY_PIPELINE_LIBRARY_DIR}:/var/jenkins_home/pipeline-library \
-v ${MY_OTHER_PIPELINE_LIBS_DIRS}:/var/jenkins_home/pipeline-libs \
-e DEV_HOST=${CURRENT_HOST} \
-p 8080:8080 -p 50000:50000 ${LCCI_IMAGE}

build-local-war:
mvn clean package -Plocal-build

10 changes: 10 additions & 0 deletions build_cache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Contains build Cache definition for the LibreCores CI Server project.
# TODO: add a DockerHub link. librecores/librecores-ci-mvn-cache
#
FROM maven:3.6.0 as mvncache
ARG LCCI_BUILD_CACHE_TAG=4b415786a0dd62559c87ade781242a9f91758185
ENV MAVEN_OPTS=-Dmaven.repo.local=/mavenrepo
WORKDIR /src
RUN git clone https://github.com/librecores/librecores-ci-jenkins-server.git . && git checkout ${LCCI_BUILD_CACHE_TAG}
RUN mvn compile dependency:resolve dependency:resolve-plugins
4 changes: 4 additions & 0 deletions build_cache/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
IMAGE_TAG="librecores/librecores-ci-mvn-cache"

build:
docker build -t ${IMAGE_TAG} .
6 changes: 6 additions & 0 deletions build_cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Maven Cache image for LibreCores CI
===================================

This base image speeds up builds of all LibreCores CI components which require Maven cache.

Image location: https://cloud.docker.com/u/librecores/repository/docker/librecores/librecores-ci-mvn-cache
137 changes: 8 additions & 129 deletions init_scripts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,130 +4,22 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.28</version>
<groupId>org.librecores.librecores-ci</groupId>
<artifactId>librecores-ci</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

<groupId>org.librecores.ci</groupId>
<artifactId>initscripts</artifactId>
<name>LibreCores CI Dev Init Scripts</name>
<description>Initialization scripts for LibreCores CI Instance</description>
<version>1.0-SNAPSHOT</version>

<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>


<properties>
<jenkins.version>2.60.3</jenkins.version>
<java.level>8</java.level>
<findbugs.failOnError>false</findbugs.failOnError>
</properties>


<dependencies>
<!-- Jenkins packages just to have code completion & co -->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-auth</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>5.12</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-aggregator</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
<version>3.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.kostyasha.yet-another-docker</groupId>
<artifactId>yet-another-docker-plugin</artifactId>
<version>0.1.0-rc37</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.synopsys.jenkinsci</groupId>
<artifactId>ownership</artifactId>
<version>0.10.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.synopsys.arc.jenkinsci.plugins</groupId>
<artifactId>job-restrictions</artifactId>
<version>0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>role-strategy</artifactId>
<version>2.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>mailer</artifactId>
<version>1.20</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>authorize-project</artifactId>
<version>1.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>locale</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>sidebar-link</artifactId>
<version>1.9.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>log-parser</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>hudson.plugins.filesystem_scm</groupId>
<artifactId>filesystem_scm</artifactId>
<version>1.21-alpha-1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.jenkins.blueocean</groupId>
<artifactId>blueocean</artifactId>
<version>1.1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>2.1.15</version>
<scope>provided</scope>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
Expand All @@ -152,18 +44,5 @@
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>


</project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.jenkinsci.core

import hudson.security.csrf.DefaultCrumbIssuer
import jenkins.CLI
import jenkins.model.Jenkins
import jenkins.security.s2m.AdminWhitelistRule
import org.kohsuke.stapler.StaplerProxy
Expand Down Expand Up @@ -30,9 +29,6 @@ class JenkinsHelper {
* Initializes the default security settings on the instance
*/
static setupDefaultSecurity() {
println("--- Configuring CLI")
CLI.get().enabled = false

println("--- Configuring Remoting and Slave2Master security")
Jenkins.instance.agentProtocols = new HashSet<String>(["JNLP4-connect"])
Jenkins.instance.getExtensionList(StaplerProxy.class)
Expand Down
Loading

0 comments on commit fe57f5a

Please sign in to comment.