Skip to content

Commit 6ffd3ca

Browse files
committed
added preliminary Alpine support
1 parent 10a1e70 commit 6ffd3ca

File tree

9 files changed

+166
-0
lines changed

9 files changed

+166
-0
lines changed

setup/ansible-inventory

+3
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,6 @@ test-ibm-aix61-ppc64-1:18822
149149
[iojs-build-rhel72-linuxonecc]
150150
test-linuxonecc-rhel72-s390x-1
151151
test-linuxonecc-rhel72-s390x-2
152+
153+
[test-ubuntu1604_docker_alpine34]
154+
test-digitalocean-ubuntu1604_docker_alpine34-x64-1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
host_vars/test-*
2+
roles/*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Alpine Linux 3.4 via Docker on Ubuntu 16.04 Setup
2+
3+
Add this to your ssh config:
4+
5+
```text
6+
Host test-digitalocean-ubuntu1604_adocker_alpine34-x64-1
7+
HostName 107.170.75.204
8+
User root
9+
#IdentityFile nodejs_build_test
10+
```
11+
12+
..then run:
13+
14+
```bash
15+
$ ansible-galaxy install -p . angstwad.docker_ubuntu
16+
$ ansible-playbook -i ../ansible-inventory ansible-playbook.yaml
17+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
- hosts: test-ubuntu1604_docker_alpine34
3+
remote_user: root
4+
gather_facts: False
5+
6+
tasks:
7+
- name: Check for python
8+
raw: which python
9+
register: python_exists
10+
failed_when: python_exists.rc > 1
11+
12+
- name: Bootstrap for the apt package
13+
raw: apt install -y python-minimal aptitude
14+
tags: bootstrap
15+
when: python_exists.rc == 1
16+
17+
- hosts: test-ubuntu1604_docker_alpine34
18+
remote_user: root
19+
gather_facts: True
20+
21+
tasks:
22+
- include_vars: ansible-vars.yaml
23+
tags: vars
24+
25+
- name: General | APT Update and upgrade
26+
apt: update_cache=yes upgrade=full
27+
tags: general
28+
29+
- name: General | Install required packages
30+
apt: name={{ item }} update_cache=yes state=latest
31+
with_items: packages
32+
tags: general
33+
34+
- name: User | Add {{ server_user }} user
35+
user: name="{{ server_user }}" shell=/bin/bash
36+
tags: user
37+
38+
- name: User | Make work directories
39+
file:
40+
path: "/home/{{ server_user }}/{{ item }}"
41+
state: directory
42+
mode: 0755
43+
owner: "{{ server_user }}"
44+
group: "{{ server_user }}"
45+
with_items:
46+
- build
47+
- tmp
48+
tags: user
49+
50+
- name: Docker | Install Docker
51+
hosts: test-ubuntu1604_docker_alpine34
52+
remote_user: root
53+
gather_facts: True
54+
roles:
55+
- angstwad.docker_ubuntu
56+
tags: docker
57+
58+
- hosts: test-ubuntu1604_docker_alpine34
59+
remote_user: root
60+
gather_facts: True
61+
62+
tasks:
63+
- name: Docker | Generate Dockerfile
64+
template: src=./resources/Dockerfile.j2 dest=/root/Dockerfile
65+
tags: docker
66+
67+
- name: Docker | Build Alpine image
68+
command: docker build -t node-ci:alpine-build /root/
69+
70+
- name: Init | Generate and copy init script
71+
template: src=./resources/jenkins.service.j2 dest=/lib/systemd/system/jenkins.service
72+
tags: init
73+
74+
- name: Init | Start Jenkins
75+
service: name=jenkins state=started enabled=yes
76+
tags: init
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
server_user: iojs
3+
packages:
4+
- curl
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[defaults]
2+
roles_path = ./roles/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- src: angstwad.docker_ubuntu
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM alpine:3.3
2+
3+
ENV LC_ALL C
4+
ENV USER {{ server_user }}
5+
ENV JOBS {{ server_jobs | default(ansible_processor_vcpus) }}
6+
ENV HOME /home/{{ server_user }}
7+
ENV NODE_TEST_DIR /home/{{ server_user }}/tmp
8+
ENV PATH /usr/lib/ccache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9+
ENV NODE_COMMON_PIPE /home/{{ server_user }}/test.pipe
10+
ENV OSTYPE linux-gnu
11+
ENV DESTCPU x64
12+
ENV ARCH x64
13+
14+
RUN apk add --no-cache \
15+
libstdc++ \
16+
&& apk add --no-cache --virtual .build-deps \
17+
binutils-gold \
18+
curl \
19+
g++ \
20+
gcc \
21+
gnupg \
22+
libgcc \
23+
linux-headers \
24+
make \
25+
paxctl \
26+
python \
27+
tar \
28+
ccache \
29+
openjdk8 \
30+
git
31+
32+
RUN addgroup -g 1000 {{ server_user }}
33+
34+
RUN adduser -G {{ server_user }} -D -u 1000 {{ server_user }}
35+
36+
VOLUME [ "/home/{{ server_user }}/" ]
37+
38+
CMD su {{ server_user }} -c '\
39+
cd /home/{{ server_user }} \
40+
&& curl https://ci.nodejs.org/jnlpJars/slave.jar -O \
41+
&& java \
42+
-jar slave.jar \
43+
-jnlpUrl https://ci.nodejs.org/computer/{{ inventory_hostname }}/slave-agent.jnlp \
44+
-secret {{ secret }} \
45+
'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[Unit]
2+
Description=Jenkins Slave in Docker
3+
Wants=network.target
4+
After=network.target
5+
6+
[Install]
7+
WantedBy=multi-user.target
8+
9+
[Service]
10+
Type=simple
11+
User=root
12+
ExecStart=/usr/bin/docker run --rm -v /home/{{ server_user }}:/home/{{ server_user }} --name node-ci-alpine node-ci:alpine-build
13+
ExecStop=/usr/bin/docker stop -t 5 node-ci-alpine
14+
Restart=always
15+
RestartSec=30
16+
StartLimitInterval=0

0 commit comments

Comments
 (0)