Skip to content

Commit

Permalink
feat: Upgrade all the things (#262)
Browse files Browse the repository at this point in the history
* feat: Upgrade all the things

Upgraded all the plugins using the plugin script in the repo.

Upgraded Jenkins to the latest LTS.

Made changes to the config handlers for the plugin updates.

Made changes to the tests to ensure they run with latest actions
versions.

Moved over to the BATS provided GitHub Action for running BATS.
feat: Upgrade to latest gosu version.

Upgraded gosu to latest upstream.

Upgraded envconsul to latest upstream.

* plugins and platform

* plugins and removed support for oic-realm

---------

Co-authored-by: Rob Lazzurs <[email protected]>
  • Loading branch information
odavid and lazzurs authored Oct 13, 2024
1 parent 0515e9a commit b939642
Show file tree
Hide file tree
Showing 16 changed files with 221 additions and 331 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
dist: [debian, alpine, jdk11]
steps:
- name: Setup BATS
uses: mig4/setup-bats@v1
uses: bats-core/bats[email protected]

- uses: actions/checkout@v2

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG FROM_TAG=2.426.3
ARG FROM_TAG=2.462.3

FROM jenkins/jenkins:${FROM_TAG}

ARG GOSU_VERSION=1.12
ARG GOSU_VERSION=1.17

# Install plugins
COPY plugins.txt /usr/share/jenkins/ref/
Expand Down Expand Up @@ -32,7 +32,7 @@ RUN pip3 install --break-system-packages --no-cache-dir --upgrade pip \
&& pip install --break-system-packages --no-cache-dir wheel \
&& pip install --break-system-packages --no-cache-dir awscli PyYAML six requests botocore boto3

RUN curl $CURL_OPTIONS https://releases.hashicorp.com/envconsul/0.10.0/envconsul_0.10.0_linux_amd64.tgz | tar -C /usr/bin -xvzf - && \
RUN curl $CURL_OPTIONS https://releases.hashicorp.com/envconsul/0.13.2/envconsul_0.13.2_linux_amd64.zip -o /tmp/envconsul.zip && unzip /tmp/envconsul.zip -d /usr/bin/ && \
chmod +x /usr/bin/envconsul

RUN curl $CURL_OPTIONS -o /usr/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64 && \
Expand Down
2 changes: 1 addition & 1 deletion LTS_VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.426.3
2.462.3
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ build-all: build-alpine build-debian build-jdk11
test-all: test-alpine test-debian test-jdk11

build-alpine:
docker build --rm --force-rm -t odavid/my-bloody-jenkins $(DEFAULT_BUILD_ARGS) --build-arg=FROM_TAG=$(LTS_VERSION)-alpine .
docker build --platform linux/amd64 --rm --force-rm -t odavid/my-bloody-jenkins $(DEFAULT_BUILD_ARGS) --build-arg=FROM_TAG=$(LTS_VERSION)-alpine .

build-debian:
docker build --rm --force-rm -t odavid/my-bloody-jenkins $(DEFAULT_BUILD_ARGS) --build-arg=FROM_TAG=$(LTS_VERSION) .
docker build --platform linux/amd64 --rm --force-rm -t odavid/my-bloody-jenkins $(DEFAULT_BUILD_ARGS) --build-arg=FROM_TAG=$(LTS_VERSION) .

build-jdk11:
docker build --rm --force-rm -t odavid/my-bloody-jenkins $(DEFAULT_BUILD_ARGS) --build-arg=FROM_TAG=$(LTS_VERSION)-jdk11 .
docker build --platform linux/amd64 --rm --force-rm -t odavid/my-bloody-jenkins $(DEFAULT_BUILD_ARGS) --build-arg=FROM_TAG=$(LTS_VERSION)-jdk11 .

test-alpine: build-alpine
bats tests
Expand Down
33 changes: 0 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,39 +350,6 @@ security:
domain: domain
```

```yaml
# oid - openid-connect configuration must be provided
security:
realm: oic
realmConfig:
### See https://plugins.jenkins.io/oic-auth/
clientId: String
clientSecret: String
# auto / manual
automanualconfigure: manual
# The Well Known Configuration source URL
wellKnownOpenIDConfigurationUrl: http://xxx.yyy
# Manual Configuration (not need if you have set the wellKnownOpenIDConfigurationUrl)
tokenServerUrl: http://xxx.yyy
authorizationServerUrl: http://xxx.yyy
userInfoServerUrl: http://xxx.yyy
logoutFromOpenidProvider: true
endSessionEndpoint: http://xxx.yyy
postLogoutRedirectUrl: http://jenkins
userNameField: preferred_username
fullNameFieldName: name
emailFieldName: email
scopes: openid profile email
groupsFieldName: groups
disableSslVerification: false
tokenFieldToCheckKey:
tokenFieldToCheckValue:
escapeHatchEnabled: true
escapeHatchUsername: admin
escapeHatchSecret: password
escapeHatchGroup:
```

```yaml
# github - github-oauth configuration must be provided
security:
Expand Down
5 changes: 2 additions & 3 deletions config-handlers/CloudsConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import jenkins.model.Jenkins
import com.nirima.jenkins.plugins.docker.*
import com.nirima.jenkins.plugins.docker.launcher.*
import com.nirima.jenkins.plugins.docker.strategy.*
import io.jenkins.docker.connector.DockerComputerJNLPConnector

import com.cloudbees.jenkins.plugins.amazonecs.*
import static com.cloudbees.jenkins.plugins.amazonecs.ECSTaskTemplate.*
Expand Down Expand Up @@ -116,9 +117,7 @@ def dockerCloud(config){

def dockerTemplate = new DockerTemplate(
dockerTemplateBase,
new io.jenkins.docker.connector.DockerComputerJNLPConnector(
new JNLPLauncher(tunnel, temp.jvmArgs)
),
new DockerComputerJNLPConnector(),
temp.labels?.join(' '),
temp.remoteFs?:'',
temp.instanceCap?.toString() ?: ""
Expand Down
3 changes: 2 additions & 1 deletion config-handlers/CredsConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.cloudbees.jenkins.plugins.awscredentials.AWSCredentialsImpl
import org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl
import jenkins.model.Jenkins
import hudson.util.Secret
import hudson.model.FileParameterValue
import org.jenkinsci.plugins.structs.describable.DescribableModel

def asInt(value, defaultValue=0){
Expand Down Expand Up @@ -133,7 +134,7 @@ def certCred(config){
def secretBytes = com.cloudbees.plugins.credentials.SecretBytes.fromString(base64)
keyStoreSource = new com.cloudbees.plugins.credentials.impl.CertificateCredentialsImpl.UploadedKeyStoreSource(secretBytes)
}else if(fileOnMaster){
keyStoreSource = new com.cloudbees.plugins.credentials.impl.CertificateCredentialsImpl.FileOnMasterKeyStoreSource(fileOnMaster)
keyStoreSource = new com.cloudbees.plugins.credentials.impl.CertificateCredentialsImpl.UploadedKeyStoreSource(new FileParameterValue.FileItemImpl(fileOnMaster), null)
}
return new com.cloudbees.plugins.credentials.impl.CertificateCredentialsImpl(
CredentialsScope.GLOBAL,
Expand Down
9 changes: 0 additions & 9 deletions config-handlers/SecurityConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,6 @@ def setupSecurityOptions(config){
}
}

def setupOpenIDConnect(config){
def realmConfig = config.realmConfig
realmConfig.escapeHatchSecret = realmConfig.escapeHatchSecret ? hudson.util.Secret.fromString(realmConfig.escapeHatchSecret) : null
return realmConfig ? DescribableModel.of(org.jenkinsci.plugins.oic.OicSecurityRealm).instantiate(realmConfig) : null
}

def setupGithubOAuth2(config){
def realmConfig = config.realmConfig
return realmConfig ? DescribableModel.of(org.jenkinsci.plugins.GithubSecurityRealm).instantiate(realmConfig) : null
Expand Down Expand Up @@ -205,9 +199,6 @@ def setup(config){
case 'google':
realm = setupGoogleOAuth2(config)
break
case 'oic':
realm = setupOpenIDConnect(config)
break
case 'github':
realm = setupGithubOAuth2(config)
break
Expand Down
Loading

0 comments on commit b939642

Please sign in to comment.