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

Enable https #11

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ivan-pinatti
Copy link
Contributor

@ivan-pinatti ivan-pinatti commented Feb 3, 2018

what

  • Add support for self-signed TLS certificates
  • A few minor improvements.

why

@osterman osterman requested a review from aknysh February 5, 2018 02:34
Dockerfile Outdated

# Allow the jenkins user to run docker
RUN adduser jenkins docker

# generate a self-signed certificate and configure HTTPS
ARG JENKINS_URL="jenkins.local"
ARG COMPANY_NAME="Cloudposse Inc"
Copy link
Contributor

@osterman osterman Feb 5, 2018

Choose a reason for hiding this comment

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

Cloud Posse, LLC =)

RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh gettext make docker
# install required packages
RUN readonly PACKAGES=" \
Copy link
Contributor

Choose a reason for hiding this comment

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

@ivan-pinatti what are your thoughts on converting this instead to an ARG?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@osterman I did it for testing purposes on my environment, however, AWS CodeBuild is running an older version of Docker that doesn't support it. So, for now we can't change.

I already submitted a PR to AWS CodeBuild adding a newer Docker Image version of Ubuntu and on top of that a newer version of Docker.

The problem is that I submitted both more than a month ago and I did not receive any interaction from AWS, it seems that they are not much attentive to the repo.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh wow, that's crazy! Feels like this feature has been in docker for ages now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, do you mean that they don't support multi-line ARG? I see you're using it everywhere else. Could you add a link to your PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@osterman I was referring to the Jenkins version itself, in the first lines of the Dockerfile, ex:

# set default version if no argument was provided
ARG JENKINS_VERSION="2.103"
FROM jenkins/jenkins:${JENKINS_VERSION}-slim

This is not supported yet.

Regarding to pass the package list as argument I don't see any gain on doing it at the moment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding to pass the package list as argument I don't see any gain on doing it at the moment.

personal bias is in favor of reducing the inline bash, when the dockerfile language defines a convention for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean, you prefer this:

# install required packages
RUN apk update && apk upgrade && apk add --no-cache bash=4.4.12-r2 docker=17.10.0-r0 gettext=0.19.8.1-r1 git=2.15.0-r1 make=4.2.1-r0 openssh=7.5_p1-r8 openssl=1.0.2n-r0

Instead of this:

# install required packages
RUN readonly PACKAGES=" \
      bash=4.4.12-r2 \
      docker=17.10.0-r0 \
      gettext=0.19.8.1-r1 \
      git=2.15.0-r1 \
      make=4.2.1-r0 \
      openssh=7.5_p1-r8 \
      openssl=1.0.2n-r0 \
    " \
    && apk update \
    && apk upgrade \
    && apk add --no-cache ${PACKAGES}

?

Copy link
Contributor

Choose a reason for hiding this comment

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

More like:

ARG PACKAGES="bash=4.4.12-r2 docker=17.10.0-r0 gettext=0.19.8.1-r1 git=2.15.0-r1 make=4.2.1-r0 openssh=7.5_p1-r8 openssl=1.0.2n-r0"
RUN apk update && apk upgrade && apk add --no-cache ${PACKAGES} ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Considering this as integrated part of Terraform Jenkins AWS, we would have to add it as a parameter into AWS CodeBuild code section as well, and I see no advantage in doing it. At least not with the current solution design.

Even though, I would prefer to have it as multi-line for better readability and improved code maintenance, something like:

# install required packages
ARG PACKAGES=" \
      bash=4.4.12-r2 \
      docker=17.10.0-r0 \
      gettext=0.19.8.1-r1 \
      git=2.15.0-r1 \
      make=4.2.1-r0 \
      openssh=7.5_p1-r8 \
      openssl=1.0.2n-r0 \
    " \

RUN apk update \
    && apk upgrade \
    && apk add --no-cache ${PACKAGES}

However, I'm not sure that Docker supports ARG multi-line syntax yet, as seen here:
(https://github.com/moby/moby/issues/35950)[https://github.com/moby/moby/issues/35950]

Copy link
Contributor

@osterman osterman left a comment

Choose a reason for hiding this comment

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

Looks good to me. Two small nit picks.

@osterman
Copy link
Contributor

osterman commented Feb 5, 2018

@ivan-pinatti btw, check out the updated description. Generally, we use this convention:

## what
* thing that changed

## why
* justifications for change

@ivan-pinatti
Copy link
Contributor Author

@osterman all changes done.

Copy link
Contributor

@aknysh aknysh left a comment

Choose a reason for hiding this comment

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

@ivan-pinatti
this PR depends on cloudposse/terraform-aws-codebuild#14
(Jenkins ENV vars).

Please se inline comments.

Basically, we don't want to pollute the codebuild module` with application-specific settings, in this case Jenkins-related

@ivan-pinatti
Copy link
Contributor Author

What is your proposition then @aknysh ?

Because the URL is required to generate the self-signed certificate during the build.

@aknysh
Copy link
Contributor

aknysh commented May 3, 2018

@ivan-pinatti
thank you again for your contribution.
I'll review it little bit later, we should come up with a good way to solve the issue.

@ivan-pinatti
Copy link
Contributor Author

No problem @aknysh.

I reviewed and I think this is the only way to give the user the option (via parameter in the module) to use their own URL and to make Jenkins to auto-generate the self-signed certificate.

The other possible solution would be somehow manage to change the Jenkins build process to retrieve a valid certificate from somewhere else, perhaps AWS S3 for example.

@aknysh
Copy link
Contributor

aknysh commented May 9, 2018

@ivan-pinatti
thanks
it was busy few weeks for us, but I'll get to this shortly and we'll discuss the best solution

@ivan-pinatti
Copy link
Contributor Author

@aknysh no problem, take your time. :)

This is a new feature, no need to rush it.

@kmcquade
Copy link

@aknysh @ivan-pinatti any plans to address this? I know it's been a while.

@kmcquade
Copy link

@aknysh friendly reminder :)

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

Successfully merging this pull request may close these issues.

4 participants