Skip to content
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

Port mapping #165

Merged
merged 8 commits into from
Jun 8, 2017
Merged

Port mapping #165

merged 8 commits into from
Jun 8, 2017

Conversation

jwhitcraft
Copy link

This is to finish up the port mapping ticket in #135.

I added the help documents, and i can fix the other issue if @carlossg and provide guidance on how it should be fixed.

@jwhitcraft jwhitcraft mentioned this pull request Jun 8, 2017
public void setPorts(List<PortMapping> ports) {
if (ports != null) {
this.ports.clear();
this.ports.addAll(ports);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the way jenkins (de)serializes is a bit confusing. In upgrades this.ports will be null because the field is not in the xml config.
What you want is to guard against that, so just remove final (I don't think there's any reason to have it) and do this.ports=ports

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I'll update it in a few and push it up.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlossg fixed.

@@ -169,8 +169,7 @@ public void setLivenessProbe(ContainerLivenessProbe livenessProbe) {
@DataBoundSetter
public void setPorts(List<PortMapping> ports) {
if (ports != null) {
this.ports.clear();
this.ports.addAll(ports);
this.ports = ports;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to check for null now

public void setPorts(List<PortMapping> ports) {
  this.ports = ports;
}

@carlossg carlossg merged commit a667a9f into jenkinsci:master Jun 8, 2017
@carlossg
Copy link
Contributor

carlossg commented Jun 8, 2017

I am merging it because it's been around for long, but it would be nice to have a pipeline test

@negz
Copy link

negz commented Jun 9, 2017

@carlossg Do you have a feeling of when the next release will be? No pressure - just wondering whether I should wait or build from master for now.

@carlossg
Copy link
Contributor

carlossg commented Jun 9, 2017

no pressure taken ;)
I need testers for #157 to +1 it so I know it's not breaking everything

@herr-bubu
Copy link

Hey Guys,
I was trying to use this plugin and it's great (in most cases) :) but I've got a problem with it.
I'm trying to set up two different Postgres dbs on on Pod, so I had to map ports because my postgres-docker exposes a port 5432 by default.
But it looks like below. It shows that this particular port is already taken.

parallel(
    failFast: true,
    "Selenium": {
      podTemplate(label: "${label}", yaml: """
        apiVersion: v1
        kind: Pod
        spec:
          serviceAccountName: ${serviceAccount}
          securityContext:
            runAsUser: 1000
            fsGroup: 1000
          containers:
          - name: postgres-main
            image: postgres:10
            ports:
            - containerPort: 5432
              hostPort: 6432
            securityContext: 
              runAsUser: 0    
          - name: postgres-chat
            image: postgres:10
            - containerPort: 5432
              hostPort: 6432
            securityContext: 
              runAsUser: 0
        """
      ) { }

Unfortunately I get this:

PostgreSQL init process complete; ready for start up.

2018-12-22 00:15:00.608 UTC [1] LOG:  could not bind IPv4 address "0.0.0.0": Address already in use
2018-12-22 00:15:00.608 UTC [1] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2018-12-22 00:15:00.608 UTC [1] LOG:  could not bind IPv6 address "::": Address already in use
2018-12-22 00:15:00.608 UTC [1] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2018-12-22 00:15:00.608 UTC [1] WARNING:  could not create listen socket for "*"
2018-12-22 00:15:00.608 UTC [1] FATAL:  could not create any TCP/IP sockets
2018-12-22 00:15:00.608 UTC [1] LOG:  database system is shut down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants