Skip to content

Commit 492c8d8

Browse files
Merge pull request #117 from hurricanehrndz/develop
Develop
2 parents 4e66753 + a03a054 commit 492c8d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+510
-289
lines changed

.Dockerfiles/alpine/latest/Dockerfile

+25-34
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,29 @@
11
FROM alpine:latest
22

3-
# - build tools are for: fig2dev which is needed by gnupg builds
4-
# - openssh is for scp
5-
# - tini is for PID 1
6-
# - changing alpine from 3.6 to 3.7 is for ansible 2.4,
7-
# but need to install ansible 2.3 for dependencies first
8-
# - shellcheck is not in the apk repository (xz/tar needed for shellcheck)
9-
# - bundler/rspec is not found on kitchen verify (symlink needed)
10-
113
RUN apk add --no-cache --update \
12-
curl net-tools \
13-
openssh-server openssh \
14-
sudo bash tini \
15-
ansible git rsync xz \
16-
gcc autoconf automake g++ libffi-dev tar libxpm-dev make \
17-
autoconf automake imagemagick-dev texinfo gettext-dev libgcrypt-dev \
18-
libgpg-error-dev libassuan-dev libksba-dev npth-dev libxfont-dev \
19-
libwmf-dev libx11-dev libxt-dev libxext-dev libxml2-dev libexif-dev perl \
20-
ruby-dev ruby-bundler \
21-
&& ln -s /usr/bin/bundle /usr/local/bin/bundle \
22-
&& ln -s /usr/bin/rspec /usr/local/bin/rspec \
23-
&& sed -i -e 's/v3\.6/v3.7/g' /etc/apk/repositories \
24-
&& apk add --update-cache --upgrade ansible \
25-
&& sed -i -e 's/v3\.7/v3.6/g' /etc/apk/repositories \
26-
&& apk add --update-cache \
27-
&& curl --silent -L -o shellcheck.tar.xz https://storage.googleapis.com/shellcheck/shellcheck-latest.linux.x86_64.tar.xz \
28-
&& tar -vxf shellcheck.tar.xz \
29-
&& mv shellcheck-latest/shellcheck /usr/local/bin/ \
30-
&& sudo mkdir -p /usr/local/src/ \
31-
&& git clone https://github.com/Distrotech/transfig.git && cd transfig \
32-
&& make && make install \
33-
&& cp -R /usr/X11R7/bin/fig2dev /usr/local/bin \
4+
bash \
5+
build-base \
6+
coreutils \
7+
curl \
8+
findutils \
9+
gcc \
10+
libffi-dev \
11+
musl-dev \
12+
net-tools \
13+
openrc \
14+
openssh \
15+
openssh-server \
16+
openssh-sftp-server \
17+
openssl-dev \
18+
py-boto \
19+
py2-pip \
20+
python2-dev \
21+
rsyslog \
22+
sudo \
23+
xz \
24+
&& pip install --upgrade pip \
3425
&& if ! getent passwd <%= @username %>; then \
35-
adduser -h /home/<%= @username %> -s /bin/bash <%= @username %>; \
26+
adduser -h /home/<%= @username %> -s /bin/bash -D <%= @username %>; \
3627
passwd -d <%= @username %>; \
3728
fi \
3829
&& echo "<%= @username %> ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
@@ -44,10 +35,10 @@ RUN apk add --no-cache --update \
4435
&& chown <%= @username %> /home/<%= @username %>/.ssh/authorized_keys \
4536
&& chmod 0600 /home/<%= @username %>/.ssh/authorized_keys \
4637
&& sed -ri 's/^#?PubkeyAuthentication\s+.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config \
38+
&& sed -ri 's/^#?PasswordAuthentication\s+.*/PasswordAuthentication no/' /etc/ssh/sshd_config \
39+
&& sed -ri 's/^#?ChallengeResponseAuthentication\s+.*/ChallengeResponseAuthentication no/' /etc/ssh/sshd_config \
4740
&& sed -ri 's/^#?UsePrivilegeSeparation\s+.*/UsePrivilegeSeparation no/' /etc/ssh/sshd_config \
4841
&& echo "UseDNS=no" >> /etc/ssh/sshd_config \
49-
&& ssh-keygen -A
42+
&& rc-update add sshd
5043

5144
EXPOSE 22
52-
53-
VOLUME [ "/sys/fs/cgroup" ]

.Dockerfiles/centos/latest/Dockerfile

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
FROM centos:latest
2+
3+
ENV container="docker"
4+
5+
RUN yum clean all \
6+
&& yum makecache \
7+
&& yum install -y epel-release \
8+
&& yum makecache \
9+
&& yum install -y \
10+
curl \
11+
findutils \
12+
gcc \
13+
glibc-langpack-en.x86_64 \
14+
libffi-devel \
15+
net-tools \
16+
openssh-server \
17+
openssl-devel \
18+
python2-devel \
19+
python2-pip \
20+
redhat-lsb \
21+
redhat-rpm-config \
22+
sudo \
23+
systemd \
24+
&& pip install --upgrade pip \
25+
&& yum clean all \
26+
&& if ! getent passwd <%= @username %>; then \
27+
useradd -d /home/<%= @username %> -m -s /usr/bin/bash -p '*' <%= @username %>; \
28+
fi \
29+
&& echo "<%= @username %> ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
30+
&& echo "Defaults !requiretty" >> /etc/sudoers \
31+
&& mkdir -p /home/<%= @username %>/.ssh \
32+
&& chown -R <%= @username %> /home/<%= @username %>/.ssh \
33+
&& chmod 0700 /home/<%= @username %>/.ssh \
34+
&& echo '<%= IO.read(@public_key).strip %>' >> /home/<%= @username %>/.ssh/authorized_keys \
35+
&& chown <%= @username %> /home/<%= @username %>/.ssh/authorized_keys \
36+
&& chmod 0600 /home/<%= @username %>/.ssh/authorized_keys \
37+
&& export LANG="en_US.UTF-8" && echo "LANG=\"en_US.UTF-8\"" > /etc/locale.conf \
38+
&& cd /lib/systemd/system/sysinit.target.wants/; ls | grep -v systemd-tmpfiles-setup | /usr/bin/xargs rm -f $1 \
39+
&& /usr/bin/rm -f /lib/systemd/system/multi-user.target.wants/* \
40+
&& /usr/bin/rm -f /etc/systemd/system/*.wants/* \
41+
&& /usr/bin/rm -f /lib/systemd/system/local-fs.target.wants/* \
42+
&& /usr/bin/rm -f /lib/systemd/system/sockets.target.wants/*udev* \
43+
&& /usr/bin/rm -f /lib/systemd/system/sockets.target.wants/*initctl* \
44+
&& /usr/bin/rm -f /lib/systemd/system/basic.target.wants/* \
45+
&& /usr/bin/rm -f /lib/systemd/system/anaconda.target.wants/* \
46+
&& /usr/bin/rm -f /lib/systemd/system/plymouth* \
47+
&& /usr/bin/rm -f /lib/systemd/system/systemd-update-utmp* \
48+
&& sed -ri 's/^#?PubkeyAuthentication\s+.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config \
49+
&& sed -ri 's/^#?UsePrivilegeSeparation\s+.*/UsePrivilegeSeparation no/' /etc/ssh/sshd_config \
50+
&& echo "UseDNS=no" >> /etc/ssh/sshd_config \
51+
&& systemctl set-default multi-user.target \
52+
&& ln -s /lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service \
53+
&& ln -s /lib/systemd/system/systemd-journald.service /etc/systemd/system/multi-user.target.wants/systemd-journald.service \
54+
&& echo $'[Unit]\
55+
\nDescription=Finish boot up\
56+
\nAfter=sshd.service\
57+
\n\
58+
\n[Service]\
59+
\nType=oneshot\
60+
\nRemainAfterExit=yes\
61+
\nExecStartPre=/bin/sleep 3s\
62+
\nExecStart=/bin/rm -f /run/nologin\
63+
\n\
64+
\n[Install]\
65+
\nWantedBy=default.target' >> /etc/systemd/system/FinishBootUp.service \
66+
&& ln -s /etc/systemd/system/FinishBootUp.service /etc/systemd/system/multi-user.target.wants/FinishBootUp.service
67+
68+
69+
EXPOSE 22
70+
71+
VOLUME [ "/sys/fs/cgroup" ]

.Dockerfiles/debian/stable/Dockerfile .Dockerfiles/debian/latest/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ RUN apt-get update \
4545
&& sed -ri 's/^#?UsePrivilegeSeparation\s+.*/UsePrivilegeSeparation no/' /etc/ssh/sshd_config \
4646
&& echo "UseDNS=no" >> /etc/ssh/sshd_config \
4747
&& systemctl set-default multi-user.target \
48-
&& ln -s /lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service \
48+
&& ln -s /lib/systemd/system/ssh.service /etc/systemd/system/multi-user.target.wants/ssh.service \
4949
&& ln -s /lib/systemd/system/systemd-journald.service /etc/systemd/system/multi-user.target.wants/systemd-journald.service \
5050
&& echo $'[Unit]\
5151
\nDescription=Finish boot up\

.Dockerfiles/fedora/latest/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ RUN dnf clean all \
5151
&& ln -s /lib/systemd/system/systemd-journald.service /etc/systemd/system/multi-user.target.wants/systemd-journald.service \
5252
&& echo $'[Unit]\
5353
\nDescription=Finish boot up\
54-
\nAfter=ssh.service\
54+
\nAfter=sshd.service\
5555
\n\
5656
\n[Service]\
5757
\nType=oneshot\

.Dockerfiles/ubuntu/latest/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ RUN apt-get update \
4545
&& sed -ri 's/^#?UsePrivilegeSeparation\s+.*/UsePrivilegeSeparation no/' /etc/ssh/sshd_config \
4646
&& echo "UseDNS=no" >> /etc/ssh/sshd_config \
4747
&& systemctl set-default multi-user.target \
48-
&& ln -s /lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service \
48+
&& ln -s /lib/systemd/system/ssh.service /etc/systemd/system/multi-user.target.wants/ssh.service \
4949
&& ln -s /lib/systemd/system/systemd-journald.service /etc/systemd/system/multi-user.target.wants/systemd-journald.service \
5050
&& echo $'[Unit]\
5151
\nDescription=Finish boot up\

.Dockerfiles/ubuntu/rolling/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ RUN apt-get update \
4646
&& sed -ri 's/^#?UsePrivilegeSeparation\s+.*/UsePrivilegeSeparation no/' /etc/ssh/sshd_config \
4747
&& echo "UseDNS=no" >> /etc/ssh/sshd_config \
4848
&& systemctl set-default multi-user.target \
49-
&& ln -s /lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service \
49+
&& ln -s /lib/systemd/system/ssh.service /etc/systemd/system/multi-user.target.wants/ssh.service \
5050
&& ln -s /lib/systemd/system/systemd-journald.service /etc/systemd/system/multi-user.target.wants/systemd-journald.service \
5151
&& echo $'[Unit]\
5252
\nDescription=Finish boot up\

.ci-tests/integration/vars/Alpine.yml

-7
This file was deleted.

.ci/ansible-setup.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
## Script is sepcifically for use on travis-ci
3+
4+
set -e
5+
6+
## This is an example setup script that you would encapsulate the installation
7+
# What version of avm setup to use
8+
echo "Setting up Ansible Version Manager"
9+
AVM_VERSION="v1.0.0"
10+
## Install Ansible 2.3.1 using pip and label it 'v2.3'
11+
export ANSIBLE_VERSIONS_0="2.3.1.0"
12+
export INSTALL_TYPE_0="pip"
13+
export ANSIBLE_LABEL_0="v2.3"
14+
## Install Ansible 2.4.1 using pip and label it 'v2.4'
15+
export ANSIBLE_VERSIONS_1="2.4.1.0"
16+
export INSTALL_TYPE_1="pip"
17+
export ANSIBLE_LABEL_1="v2.4"
18+
# Whats the default version
19+
export ANSIBLE_DEFAULT_VERSION="v2.4"
20+
21+
## Create a temp dir to download avm
22+
avm_dir="$(mktemp -d 2> /dev/null || mktemp -d -t 'mytmpdir')"
23+
git clone https://github.com/ahelal/avm.git "${avm_dir}" > /dev/null 2>&1
24+
25+
## Run the setup
26+
/bin/sh ${avm_dir}/setup.sh
27+
28+
exit 0

.ci/before_deploy.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ if [[ "$GITSECRET_DIST" == "rpm" ]]; then
77
sudo apt-get install -y rpm;
88
fi
99

10-
11-
if [[ ! -z "$DOCKER_DIST" ]]; then
10+
if [[ ! -z "$GITSECRET_DIST" ]] && [[ -z "$KITCHEN_REGEXP" ]]; then
1211
# When making a non-container build, this step will generate
1312
# proper manifest files:
14-
make "deploy-${GITSECRET_DIST}";
13+
make "deploy-$GITSECRET_DIST";
1514
fi

.ci/before_script.sh

+23-12
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,33 @@
22

33
set -e
44

5-
# Docker:
6-
if [[ ! -z "$DOCKER_DIST" ]]; then
7-
TEMPLATE="sobolevn/git-secret-docker-$DOCKER_DIST"
8-
DOCKERFILE_PATH=".docker/${GITSECRET_DIST}/${DOCKER_DIST}"
5+
# Linux helper functions:
6+
function update_linux() {
7+
sudo apt-get update -qq
8+
sudo apt-get install -qq python-apt python-pycurl git python-pip ruby ruby-dev build-essential autoconf rpm
9+
gem install bundler
10+
}
11+
12+
function install_ansible {
13+
bash .ci/ansible-setup.sh
14+
bundle install
15+
~/.avm/v2.3/venv/bin/pip install netaddr ansible-lint
16+
~/.avm/v2.4/venv/bin/pip install netaddr ansible-lint
17+
}
918

10-
# Building the local image:
11-
docker build -t "$TEMPLATE" "$DOCKERFILE_PATH"
12-
fi
1319

1420
# Mac:
1521
if [[ "$GITSECRET_DIST" == "brew" ]]; then
16-
brew install "$GITSECRET_GPG_DEP"
22+
gnupg_installed="$(brew list | grep -c "gnupg")"
23+
[[ "$gnupg_installed" -ge 1 ]] || brew install gnupg
24+
if [[ -f "/usr/local/bin/gpg1" ]]; then
25+
ln -s /usr/local/bin/gpg1 /usr/local/bin/gpg
26+
fi
27+
brew install gawk
1728
fi
1829

19-
# Local linux (standart build):
20-
if [[ "$GITSECRET_DIST" == "none" ]] && [[ "$GITSECRET_GPG_DEP" == "gnupg2" ]]; then
21-
# Installing custom GPG version:
22-
sudo apt-get install -y gnupg2
30+
# Linux:
31+
if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ -n "$KITCHEN_REGEXP" ]]; then
32+
update_linux
33+
install_ansible
2334
fi

.ci-tests/integration/gnupg1/default.yml .ci/integration/gnupg1/default.yml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
distribution: Fedora
1919
- name: gnupg1
2020
distribution: Debian
21+
- name: gnupg1
22+
distribution: Alpine
2123

2224
- name: Check for gpg1 binary
2325
stat:

.ci-tests/integration/gnupg2/serverspec/default_spec.rb .ci/integration/gnupg1/serverspec/default_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
it { should be_installed }
77
end
88

9-
if host_inventory['platform'] == 'fedora'
9+
if host_inventory['platform'] == 'fedora' || host_inventory['platform'] == 'redhat'
1010
describe command('find /tmp/git-secret/build -name "*.rpm"') do
1111
its(:stdout) { should match /git-secret.*rpm/ }
1212
end
@@ -16,7 +16,7 @@
1616
end
1717
else
1818
describe command('find /tmp/git-secret/build -name "*.deb"') do
19-
its(:stdout) { should match /git-secret.*deb/ }
19+
its(:stdout) { should match(/git-secret.*deb/) }
2020
end
2121
end
2222

@@ -28,7 +28,7 @@
2828
it { should exist }
2929
end
3030

31-
if host_inventory['platform'] == 'fedora'
31+
if host_inventory['platform'] == 'fedora' || host_inventory['platform'] == 'redhat'
3232
describe command('rpm --query --info git-secret') do
3333
its(:exit_status) { should eq 0 }
3434
end

.ci-tests/integration/gnupg2/default.yml .ci/integration/gnupg2/default.yml

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
distribution: Ubuntu
2121
- name: gnupg
2222
distribution: Debian
23+
- name: gnupg
24+
distribution: Alpine
2325

2426
- name: Check for gpg2 binary
2527
stat:

.ci-tests/integration/gnupg1/serverspec/default_spec.rb .ci/integration/gnupg2/serverspec/default_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
describe 'git-secret::test' do
44

55
describe package('git-secret') do
6-
it { should be_installed }
6+
it { should be_installed }
77
end
88

9-
if host_inventory['platform'] == 'fedora'
9+
if host_inventory['platform'] == 'fedora' || host_inventory['platform'] == 'redhat'
1010
describe command('find /tmp/git-secret/build -name "*.rpm"') do
11-
its(:stdout) { should match /git-secret.*rpm/ }
11+
its(:stdout) { should match(/git-secret.*rpm/) }
1212
end
1313
elsif host_inventory['platform'] == 'alpine'
1414
describe command('find /tmp/git-secret/build -name "*.apk"') do
1515
its(:stdout) { should match /git-secret.*apk/ }
1616
end
1717
else
1818
describe command('find /tmp/git-secret/build -name "*.deb"') do
19-
its(:stdout) { should match /git-secret.*deb/ }
19+
its(:stdout) { should match(/git-secret.*deb/) }
2020
end
2121
end
2222

@@ -28,7 +28,7 @@
2828
it { should exist }
2929
end
3030

31-
if host_inventory['platform'] == 'fedora'
31+
if host_inventory['platform'] == 'fedora' || host_inventory['platform'] == 'redhat'
3232
describe command('rpm --query --info git-secret') do
3333
its(:exit_status) { should eq 0 }
3434
end

.ci-tests/integration/tasks/dependencies.yml .ci/integration/tasks/dependencies.yml

+11
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@
2323
dest: /usr/bin/bats
2424
state: link
2525

26+
- name: Get ShellCheck
27+
get_url:
28+
url: https://storage.googleapis.com/shellcheck/shellcheck-latest.linux.x86_64.tar.xz
29+
dest: /tmp/shellcheck.tar.xz
30+
31+
- name: Install ShellCheck
32+
command: tar xvf /tmp/shellcheck.tar.xz -C /usr/bin --strip-components=1
33+
args:
34+
warn: no
35+
creates: /usr/bin/shellcheck
36+
2637
- name: Install fpm
2738
gem:
2839
name: fpm

.ci-tests/integration/tasks/run-tests.yml .ci/integration/tasks/run-tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
- name: Set git-secret {{ os_pkg_type }} location
5454
set_fact:
5555
pkg_path: "{{ pkg_location.files | map(attribute='path') | first }}"
56+
when:
57+
- pkg_location is defined
5658

5759
- name: Install git-secret {{ os_pkg_type }} package
5860
command: bash -lc "{{ item.command }} {{ pkg_path }}"

.ci/integration/vars/Alpine.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
test_dependencies:
3+
- gawk
4+
- git
5+
- make
6+
- man
7+
- procps
8+
- rsync
9+
- ruby
10+
- ruby-dev
11+
- tar
12+
13+
build_tools:
14+
- make
15+
- tar

0 commit comments

Comments
 (0)