Skip to content

Commit bfb6f1e

Browse files
author
Alexandru Cheltuitor
committed
Merge branch 'unstable-0.4.0' into 'master'
Update version See merge request ProtonVPN/linux/proton-python-client!28
2 parents 310df1e + b2977a5 commit bfb6f1e

39 files changed

+1600
-498
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.git
2+
.env
3+
._SOURCE_APP

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ MANIFEST
66
.vscode/
77
*.lock
88
__SOURCE_APP
9+
.env

.gitlab-ci.yml

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
1+
## Jobs to build and publish deb, rpm and arch based packages
2+
include:
3+
- project: 'ProtonVPN/Linux/_gitlab-ci'
4+
ref: public-protonvpn-repo
5+
file: 'gitlab-ci-build-publish-debian.yml'
6+
- project: 'ProtonVPN/Linux/_gitlab-ci'
7+
ref: public-protonvpn-repo
8+
file: 'gitlab-ci-build-publish-rpm.yml'
9+
- project: 'ProtonVPN/Linux/_gitlab-ci'
10+
ref: public-protonvpn-repo
11+
file: 'gitlab-ci-build-publish-arch.yml'
12+
- project: 'agarroux/publish-github'
13+
ref: master
14+
file: '/jobs/release.gitlab-ci.yml'
15+
116
default:
217
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG
318

419
stages:
520
- image
621
- test
22+
- build
23+
- publish
24+
- message
725
- image-latest
826
- release
927

28+
variables:
29+
CI_REGISTRY_IMAGE_PROTON: "$CI_REGISTRY/infra/kubernetes/images"
30+
PKGNAME_ARCH: "python-proton-client"
31+
PKGNAME_RPM: "python3-proton-client"
32+
ORIGINAL_PKGNAME: "proton-python-client"
33+
34+
1035
########## Manage the Image ##########
1136
.common-image:
1237
image: $CI_REGISTRY/infra/kubernetes/images/docker:stable
@@ -21,18 +46,30 @@ stages:
2146
- apk add make bash git gawk rsync
2247

2348

24-
# Make image when we push to a branch -> run tests on top of this one
25-
publish:
49+
## Make image when we push to a branch -> run tests on top of this one
50+
make-image-deb:
2651
stage: image
2752
extends: .common-image
2853
except:
2954
- schedules
3055
- triggers
3156
script:
32-
- make image branch=$CI_COMMIT_REF_SLUG
57+
- make image-deb branch=$CI_COMMIT_REF_SLUG src=ubuntu
58+
59+
make-image-rpm:
60+
stage: image
61+
extends: make-image-deb
62+
script:
63+
- make image-rpm branch=$CI_COMMIT_REF_SLUG src=fedora
64+
65+
make-image-arch:
66+
stage: image
67+
extends: make-image-deb
68+
script:
69+
- make image-arch branch=$CI_COMMIT_REF_SLUG src=archlinux
3370

34-
# Once the CI is green, we retag the current branch-master to latest
35-
publish-latest:
71+
## Once the CI is green, we retag the current branch-master to latest
72+
publish-latest-deb:
3673
stage: image-latest
3774
extends: .common-image
3875
dependencies: [] # Prevent download + extract artifacts
@@ -42,24 +79,43 @@ publish-latest:
4279
- schedules
4380
- triggers
4481
script:
45-
- make latest
46-
82+
- make latest src=ubuntu
4783

84+
publish-latest-rpm:
85+
extends: publish-latest-deb
86+
script:
87+
- make latest src=fedora
88+
89+
publish-latest-arch:
90+
extends: publish-latest-deb
91+
script:
92+
- make latest src=archlinux
4893

49-
########## CI Jobs ##########
5094

51-
test:
95+
######### CI Jobs ##########
96+
test-deb:
5297
stage: test
98+
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG-ubuntu
5399
interruptible: true
100+
needs:
101+
- job: make-image-deb
54102
script:
55103
- python3 -m pytest
56104

57-
## Jobs to publish commits + tags from master to github
58-
include:
59-
- project: 'agarroux/publish-github'
60-
ref: master
61-
file: '/jobs/release.gitlab-ci.yml'
105+
test-rpm:
106+
extends: test-deb
107+
needs:
108+
- job: make-image-rpm
109+
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG-fedora
110+
111+
test-arch:
112+
extends: test-deb
113+
needs:
114+
- job: make-image-arch
115+
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG-archlinux
62116

117+
118+
## Jobs to publish commits + tags from master to github
63119
release-publish-github:
64120
stage: release
65121
variables:

Dockerfile.arch

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM IMAGE_URL_ARCH
2+
ARG pkgname
3+
ENV pkgname=${pkgname:-python-proton-client}
4+
RUN pacman -Syu --noconfirm \
5+
pacman-contrib \
6+
base-devel \
7+
bash \
8+
sudo \
9+
make \
10+
python \
11+
python-pip \
12+
bash \
13+
vim \
14+
nano \
15+
namcap \
16+
python-requests \
17+
python-pyopenssl \
18+
python-bcrypt \
19+
python-gnupg \
20+
python-pytest \
21+
python-pytest-cov \
22+
&& useradd -ms /bin/bash user \
23+
&& usermod -a -G wheel user \
24+
&& echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
25+
26+
COPY docker_entry.sh /usr/local/bin
27+
COPY . /home/user/$pkgname
28+
29+
RUN chown -R user:user /home/user/
30+
USER user
31+
WORKDIR /home/user/$pkgname
32+
33+
ENTRYPOINT ["/usr/local/bin/docker_entry.sh"]

Dockerfile renamed to Dockerfile.deb

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
FROM ubuntu:latest
1+
FROM IMAGE_URL_DEB
22
RUN apt-get update
33
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
44

55
# Install a few useful packages
66

7-
RUN apt-get install -y net-tools \
7+
RUN apt-get install -y \
8+
net-tools \
89
apt-utils \
910
iproute2 \
1011
python3 \
@@ -17,39 +18,27 @@ RUN apt-get install -y net-tools \
1718
openvpn \
1819
libssl-dev
1920

20-
RUN apt-get install -y \
21-
python3-pip \
22-
python3-xdg \
23-
python3-keyring \
24-
python3-jinja2 \
25-
python3-dialog \
26-
python3-pytest \
27-
python3-distro \
28-
libcairo2-dev \
29-
libgirepository1.0-dev \
30-
gir1.2-nm-1.0
31-
32-
RUN python3 -m pip install cython && \
33-
python3 -m pip install proton-client && \
34-
python3 -m pip install keyring && \
35-
python3 -m pip install pytest-cov && \
36-
python3 -m pip install --upgrade sentry-sdk==0.10.2
37-
38-
COPY requirements.txt /tmp
39-
RUN python3 -m pip install -r /tmp/requirements.txt && \
40-
true
41-
4221
RUN apt-get install -y \
4322
dbus-x11 \
4423
libsecret-tools \
4524
gnome-keyring
4625

26+
RUN apt-get install -y \
27+
python3-bcrypt \
28+
python3-gnupg \
29+
python3-openssl \
30+
python3-requests >= 2.16.0
31+
32+
RUN apt-get install -y \
33+
python3-pytest \
34+
python3-pytest-cov
35+
4736
RUN useradd -ms /bin/bash user
4837
RUN usermod -a -G sudo user
4938
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
5039

5140
COPY docker_entry.sh /usr/local/bin
52-
COPY __SOURCE_APP /home/user/proton-python-client
41+
COPY . /home/user/proton-python-client
5342

5443
RUN chown -R user:user /home/user/proton-python-client
5544
WORKDIR /home/user/proton-python-client

Dockerfile.rpm

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM IMAGE_URL_RPM
2+
RUN dnf update -y
3+
4+
# RUN yum -y install epel-release && yum repolist
5+
6+
RUN dnf install -y \
7+
gcc \
8+
sudo \
9+
rpm-build \
10+
rpm-devel \
11+
rpmlint \
12+
make \
13+
python3 \
14+
python3-pip \
15+
bash \
16+
coreutils \
17+
diffutils \
18+
patch \
19+
rpmdevtools \
20+
rpm-sign \
21+
vim \
22+
openssl-devel \
23+
openssl-libs
24+
25+
RUN dnf install -y \
26+
python3-requests \
27+
python3-pyOpenSSL \
28+
python3-bcrypt \
29+
python3-gnupg
30+
31+
RUN dnf install -y \
32+
python3-pytest \
33+
python3-pytest-cov
34+
35+
RUN useradd -ms /bin/bash user
36+
RUN usermod -a -G wheel user
37+
RUN echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
38+
39+
COPY docker_entry.sh /usr/local/bin
40+
COPY . /home/user/proton-python-client
41+
42+
RUN chown -R user:user /home/user/
43+
USER user
44+
WORKDIR /home/user/proton-python-client
45+
46+
ENTRYPOINT ["/usr/local/bin/docker_entry.sh"]

0 commit comments

Comments
 (0)