mirror of https://github.com/sobolevn/git-secret
Merge pull request #114 from newcontext-oss/feature/add_alpine_integration_tests
add integration tests for alpine linuxpull/119/merge
commit
4e6675363c
@ -0,0 +1,53 @@
|
||||
FROM alpine:latest
|
||||
|
||||
# - build tools are for: fig2dev which is needed by gnupg builds
|
||||
# - openssh is for scp
|
||||
# - tini is for PID 1
|
||||
# - changing alpine from 3.6 to 3.7 is for ansible 2.4,
|
||||
# but need to install ansible 2.3 for dependencies first
|
||||
# - shellcheck is not in the apk repository (xz/tar needed for shellcheck)
|
||||
# - bundler/rspec is not found on kitchen verify (symlink needed)
|
||||
|
||||
RUN apk add --no-cache --update \
|
||||
curl net-tools \
|
||||
openssh-server openssh \
|
||||
sudo bash tini \
|
||||
ansible git rsync xz \
|
||||
gcc autoconf automake g++ libffi-dev tar libxpm-dev make \
|
||||
autoconf automake imagemagick-dev texinfo gettext-dev libgcrypt-dev \
|
||||
libgpg-error-dev libassuan-dev libksba-dev npth-dev libxfont-dev \
|
||||
libwmf-dev libx11-dev libxt-dev libxext-dev libxml2-dev libexif-dev perl \
|
||||
ruby-dev ruby-bundler \
|
||||
&& ln -s /usr/bin/bundle /usr/local/bin/bundle \
|
||||
&& ln -s /usr/bin/rspec /usr/local/bin/rspec \
|
||||
&& sed -i -e 's/v3\.6/v3.7/g' /etc/apk/repositories \
|
||||
&& apk add --update-cache --upgrade ansible \
|
||||
&& sed -i -e 's/v3\.7/v3.6/g' /etc/apk/repositories \
|
||||
&& apk add --update-cache \
|
||||
&& curl --silent -L -o shellcheck.tar.xz https://storage.googleapis.com/shellcheck/shellcheck-latest.linux.x86_64.tar.xz \
|
||||
&& tar -vxf shellcheck.tar.xz \
|
||||
&& mv shellcheck-latest/shellcheck /usr/local/bin/ \
|
||||
&& sudo mkdir -p /usr/local/src/ \
|
||||
&& git clone https://github.com/Distrotech/transfig.git && cd transfig \
|
||||
&& make && make install \
|
||||
&& cp -R /usr/X11R7/bin/fig2dev /usr/local/bin \
|
||||
&& if ! getent passwd <%= @username %>; then \
|
||||
adduser -h /home/<%= @username %> -s /bin/bash <%= @username %>; \
|
||||
passwd -d <%= @username %>; \
|
||||
fi \
|
||||
&& echo "<%= @username %> ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
|
||||
&& echo "Defaults !requiretty" >> /etc/sudoers \
|
||||
&& mkdir -p /home/<%= @username %>/.ssh \
|
||||
&& chown -R <%= @username %> /home/<%= @username %>/.ssh \
|
||||
&& chmod 0700 /home/<%= @username %>/.ssh \
|
||||
&& echo '<%= IO.read(@public_key).strip %>' >> /home/<%= @username %>/.ssh/authorized_keys \
|
||||
&& chown <%= @username %> /home/<%= @username %>/.ssh/authorized_keys \
|
||||
&& chmod 0600 /home/<%= @username %>/.ssh/authorized_keys \
|
||||
&& sed -ri 's/^#?PubkeyAuthentication\s+.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config \
|
||||
&& sed -ri 's/^#?UsePrivilegeSeparation\s+.*/UsePrivilegeSeparation no/' /etc/ssh/sshd_config \
|
||||
&& echo "UseDNS=no" >> /etc/ssh/sshd_config \
|
||||
&& ssh-keygen -A
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
VOLUME [ "/sys/fs/cgroup" ]
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
test_dependencies:
|
||||
- gawk
|
||||
- man
|
||||
|
||||
build_tools:
|
||||
- make
|
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "${SECRET_PROJECT_ROOT}/utils/build-utils.sh"
|
||||
|
||||
preinstall_files "-c"
|
||||
|
||||
# Building .deb package:
|
||||
cd "$SCRIPT_DEST_DIR" && build_package "apk"
|
||||
|
||||
# Cleaning up:
|
||||
clean_up_files && cd "${SECRET_PROJECT_ROOT}"
|
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# Note that this file is created for test purposes:
|
||||
# 1. It runs inside the Docker container
|
||||
# 2. It does not use `sudo` or anything
|
||||
# 3. If you would like to install `.apk` package on your system, see `Installation`
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "${SECRET_PROJECT_ROOT}/utils/build-utils.sh"
|
||||
|
||||
# This folder should contain just one .apk file:
|
||||
APK_FILE_LOCATION=$(locate_apk)
|
||||
|
||||
|
||||
# Integration tests
|
||||
function integration_tests {
|
||||
# Installing the package:
|
||||
apk add "$APK_FILE_LOCATION"
|
||||
|
||||
# Configuring the dependencies:
|
||||
apk add --update-cache
|
||||
|
||||
# Testing the installation:
|
||||
apk info | grep "git-secret"
|
||||
which "git-secret"
|
||||
|
||||
# Test the manuals:
|
||||
man --where "git-secret" # .7
|
||||
man --where "git-secret-init" # .1
|
||||
}
|
||||
|
||||
integration_tests
|
||||
|
||||
# Unit tests:
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "${SECRET_PROJECT_ROOT}/utils/tests.sh"
|
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "${SECRET_PROJECT_ROOT}/utils/build-utils.sh"
|
||||
|
||||
# Variables, which will be used in `bintray.json`:
|
||||
SCRIPT_VERSION=$(bash "${PWD}/git-secret" --version)
|
||||
RELEASE_DATE=$(date +%Y-%m-%d)
|
||||
|
||||
# add `\"override\": 1 \` into the `matrixParams`, if needed:
|
||||
echo "{ \
|
||||
\"package\": { \
|
||||
\"name\": \"git-secret\", \
|
||||
\"repo\": \"apk\", \
|
||||
\"subject\": \"sobolevn\" \
|
||||
}, \
|
||||
\"version\": {
|
||||
\"name\": \"${SCRIPT_VERSION}\", \
|
||||
\"desc\": \"Version ${SCRIPT_VERSION}\", \
|
||||
\"released\": \"${RELEASE_DATE}\", \
|
||||
\"vcs_tag\": \"v${SCRIPT_VERSION}\", \
|
||||
\"gpgSign\": true \
|
||||
}, \
|
||||
\"files\": [{ \
|
||||
\"includePattern\": \"build/buildroot/(.*\.apk)\", \
|
||||
\"uploadPattern\": \"/git-secret_${SCRIPT_VERSION}_all.apk\" \
|
||||
}], \
|
||||
\"publish\": true \
|
||||
}" > "${SECRET_PROJECT_ROOT}/build/apk_descriptor.json"
|
Loading…
Reference in New Issue