Skip to content

Commit

Permalink
Merge branch 'unstable-0.4.0' into 'master'
Browse files Browse the repository at this point in the history
Update version

See merge request ProtonVPN/linux/proton-python-client!28
  • Loading branch information
Alexandru Cheltuitor committed Apr 20, 2021
2 parents 310df1e + b2977a5 commit bfb6f1e
Show file tree
Hide file tree
Showing 39 changed files with 1,600 additions and 498 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
.env
._SOURCE_APP
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ MANIFEST
.vscode/
*.lock
__SOURCE_APP
.env
84 changes: 70 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
## Jobs to build and publish deb, rpm and arch based packages
include:
- project: 'ProtonVPN/Linux/_gitlab-ci'
ref: public-protonvpn-repo
file: 'gitlab-ci-build-publish-debian.yml'
- project: 'ProtonVPN/Linux/_gitlab-ci'
ref: public-protonvpn-repo
file: 'gitlab-ci-build-publish-rpm.yml'
- project: 'ProtonVPN/Linux/_gitlab-ci'
ref: public-protonvpn-repo
file: 'gitlab-ci-build-publish-arch.yml'
- project: 'agarroux/publish-github'
ref: master
file: '/jobs/release.gitlab-ci.yml'

default:
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG

stages:
- image
- test
- build
- publish
- message
- image-latest
- release

variables:
CI_REGISTRY_IMAGE_PROTON: "$CI_REGISTRY/infra/kubernetes/images"
PKGNAME_ARCH: "python-proton-client"
PKGNAME_RPM: "python3-proton-client"
ORIGINAL_PKGNAME: "proton-python-client"


########## Manage the Image ##########
.common-image:
image: $CI_REGISTRY/infra/kubernetes/images/docker:stable
Expand All @@ -21,18 +46,30 @@ stages:
- apk add make bash git gawk rsync


# Make image when we push to a branch -> run tests on top of this one
publish:
## Make image when we push to a branch -> run tests on top of this one
make-image-deb:
stage: image
extends: .common-image
except:
- schedules
- triggers
script:
- make image branch=$CI_COMMIT_REF_SLUG
- make image-deb branch=$CI_COMMIT_REF_SLUG src=ubuntu

make-image-rpm:
stage: image
extends: make-image-deb
script:
- make image-rpm branch=$CI_COMMIT_REF_SLUG src=fedora

make-image-arch:
stage: image
extends: make-image-deb
script:
- make image-arch branch=$CI_COMMIT_REF_SLUG src=archlinux

# Once the CI is green, we retag the current branch-master to latest
publish-latest:
## Once the CI is green, we retag the current branch-master to latest
publish-latest-deb:
stage: image-latest
extends: .common-image
dependencies: [] # Prevent download + extract artifacts
Expand All @@ -42,24 +79,43 @@ publish-latest:
- schedules
- triggers
script:
- make latest

- make latest src=ubuntu

publish-latest-rpm:
extends: publish-latest-deb
script:
- make latest src=fedora

publish-latest-arch:
extends: publish-latest-deb
script:
- make latest src=archlinux

########## CI Jobs ##########

test:
######### CI Jobs ##########
test-deb:
stage: test
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG-ubuntu
interruptible: true
needs:
- job: make-image-deb
script:
- python3 -m pytest

## Jobs to publish commits + tags from master to github
include:
- project: 'agarroux/publish-github'
ref: master
file: '/jobs/release.gitlab-ci.yml'
test-rpm:
extends: test-deb
needs:
- job: make-image-rpm
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG-fedora

test-arch:
extends: test-deb
needs:
- job: make-image-arch
image: $CI_REGISTRY_IMAGE:branch-$CI_COMMIT_REF_SLUG-archlinux


## Jobs to publish commits + tags from master to github
release-publish-github:
stage: release
variables:
Expand Down
33 changes: 33 additions & 0 deletions Dockerfile.arch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM IMAGE_URL_ARCH
ARG pkgname
ENV pkgname=${pkgname:-python-proton-client}
RUN pacman -Syu --noconfirm \
pacman-contrib \
base-devel \
bash \
sudo \
make \
python \
python-pip \
bash \
vim \
nano \
namcap \
python-requests \
python-pyopenssl \
python-bcrypt \
python-gnupg \
python-pytest \
python-pytest-cov \
&& useradd -ms /bin/bash user \
&& usermod -a -G wheel user \
&& echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

COPY docker_entry.sh /usr/local/bin
COPY . /home/user/$pkgname

RUN chown -R user:user /home/user/
USER user
WORKDIR /home/user/$pkgname

ENTRYPOINT ["/usr/local/bin/docker_entry.sh"]
39 changes: 14 additions & 25 deletions Dockerfile → Dockerfile.deb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM ubuntu:latest
FROM IMAGE_URL_DEB
RUN apt-get update
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata

# Install a few useful packages

RUN apt-get install -y net-tools \
RUN apt-get install -y \
net-tools \
apt-utils \
iproute2 \
python3 \
Expand All @@ -17,39 +18,27 @@ RUN apt-get install -y net-tools \
openvpn \
libssl-dev

RUN apt-get install -y \
python3-pip \
python3-xdg \
python3-keyring \
python3-jinja2 \
python3-dialog \
python3-pytest \
python3-distro \
libcairo2-dev \
libgirepository1.0-dev \
gir1.2-nm-1.0

RUN python3 -m pip install cython && \
python3 -m pip install proton-client && \
python3 -m pip install keyring && \
python3 -m pip install pytest-cov && \
python3 -m pip install --upgrade sentry-sdk==0.10.2

COPY requirements.txt /tmp
RUN python3 -m pip install -r /tmp/requirements.txt && \
true

RUN apt-get install -y \
dbus-x11 \
libsecret-tools \
gnome-keyring

RUN apt-get install -y \
python3-bcrypt \
python3-gnupg \
python3-openssl \
python3-requests >= 2.16.0

RUN apt-get install -y \
python3-pytest \
python3-pytest-cov

RUN useradd -ms /bin/bash user
RUN usermod -a -G sudo user
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

COPY docker_entry.sh /usr/local/bin
COPY __SOURCE_APP /home/user/proton-python-client
COPY . /home/user/proton-python-client

RUN chown -R user:user /home/user/proton-python-client
WORKDIR /home/user/proton-python-client
Expand Down
46 changes: 46 additions & 0 deletions Dockerfile.rpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM IMAGE_URL_RPM
RUN dnf update -y

# RUN yum -y install epel-release && yum repolist

RUN dnf install -y \
gcc \
sudo \
rpm-build \
rpm-devel \
rpmlint \
make \
python3 \
python3-pip \
bash \
coreutils \
diffutils \
patch \
rpmdevtools \
rpm-sign \
vim \
openssl-devel \
openssl-libs

RUN dnf install -y \
python3-requests \
python3-pyOpenSSL \
python3-bcrypt \
python3-gnupg

RUN dnf install -y \
python3-pytest \
python3-pytest-cov

RUN useradd -ms /bin/bash user
RUN usermod -a -G wheel user
RUN echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

COPY docker_entry.sh /usr/local/bin
COPY . /home/user/proton-python-client

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

ENTRYPOINT ["/usr/local/bin/docker_entry.sh"]
Loading

0 comments on commit bfb6f1e

Please sign in to comment.