Skip to content

Commit

Permalink
Merge pull request #4 from scality/feature/ZENKO-3749-github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisferrand authored Dec 1, 2021
2 parents d803d5b + 32df6c1 commit d28febc
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 136 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: static-container-registry

on: push

env:
DOCKER_IMAGE: registry.scality.com/static-container-registry-dev/static-container-registry

jobs:
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
#TODO: add annotations
#- uses: cclauss/[email protected]
- name: Install dependencies
run: |
pip install pylint
- name: Analysing the code with pylint
run: |
pylint `ls -R|grep .py$|xargs`
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildk
uses: docker/setup-buildx-action@v1

- name: Login to Registry
uses: docker/login-action@v1
with:
registry: registry.scality.com
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: "${{ env.DOCKER_IMAGE }}:${{ github.sha }}"
cache-from: type=gha
cache-to: type=gha,mode=max

test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: |
OS=xUbuntu_20.04
CRIO_VERSION=1.21
KUBIC_REPO=https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable
sudo tee /etc/apt/sources.list.d/kubic-libcontainers.list <<< "deb $KUBIC_REPO/$OS/ /"
sudo tee -a /etc/apt/sources.list.d/kubic-libcontainers.list <<< "deb $KUBIC_REPO:/cri-o:/$CRIO_VERSION/$OS/ /"
curl -L $KUBIC_REPO/$OS/Release.key | sudo apt-key add -
curl -L $KUBIC_REPO:/cri-o:/$CRIO_VERSION/$OS/Release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install cri-o cri-o-runc cri-tools hardlink
# Fix libpcre2-posix2 package version, use the
sudo apt-get -y install --reinstall --allow-downgrades libpcre2-posix2/$(lsb_release -cs)
# Also need oras, skopeo ; but they are already installed
bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh)
# Start cri-o service
sudo systemctl start crio
# TODO: cache the installed image?

- name: Unit testing with bash_unit
run: |
export IMAGE="${{ env.DOCKER_IMAGE }}:${{ github.sha }}"
sudo FORCE_COLOR=true ./bash_unit test.sh
# TODO: parse individual tests results (in TAP format)
# - uses: dorny/test-reporter@v1
# if: success() || failure()
43 changes: 43 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: release

on:
push:
tags:
- '*.*.*'

env:
DOCKER_IMAGE: registry.scality.com/static-container-registry/static-container-registry

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildk
uses: docker/setup-buildx-action@v1

- name: Login to Registry
uses: docker/login-action@v1
with:
registry: registry.scality.com
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: "${{ env.DOCKER_IMAGE }}:${{ github.ref_name }}"
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apk add --no-cache \

VOLUME /var/lib/images
COPY entrypoint.sh /entrypoint.sh
COPY static-container-registry.py /static-container-registry.py
COPY static_container_registry.py /static_container_registry.py

ENTRYPOINT ["/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Now we're ready to create an Nginx configuration file that can be `include`d in
a larger configuration:

```
$ ./static-container-registry.py ./images > registry.conf
$ ./static_container_registry.py ./images > registry.conf
```

The following options are available:
Expand Down
66 changes: 0 additions & 66 deletions ci/before-install.sh

This file was deleted.

17 changes: 12 additions & 5 deletions ci/docker/image-provisioner/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
FROM docker.io/ubuntu:xenial
ARG OS_VERSION=20.04
FROM docker.io/ubuntu:$OS_VERSION

RUN apt-get update \
ARG OS_VERSION
ARG REPOSITORY=https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable
RUN export DEBIAN_FRONTEND=noninteractive \
&& \
apt-get install -y software-properties-common\
apt-get update \
&& \
apt-get install -y curl software-properties-common \
&& \
echo "deb ${REPOSITORY}/xUbuntu_${OS_VERSION}/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list \
&& \
add-apt-repository ppa:projectatomic/ppa \
curl -L ${REPOSITORY}/xUbuntu_${OS_VERSION}/Release.key | apt-key add - \
&& \
apt-get update \
&& \
apt-get install -y skopeo

RUN apt-get install \
RUN apt-get install -y \
hardlink

COPY provision-images.sh /provision-images.sh
37 changes: 19 additions & 18 deletions ci/docker/sut/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
FROM docker.io/ubuntu:xenial
ARG OS_VERSION=20.04
FROM docker.io/ubuntu:$OS_VERSION

RUN apt-get update \
ARG OS_VERSION
ARG REPOSITORY=https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable
RUN export DEBIAN_FRONTEND=noninteractive \
&& \
apt-get install -y software-properties-common\
apt-get update \
&& \
apt-get install -y curl software-properties-common \
&& \
echo "deb ${REPOSITORY}/xUbuntu_${OS_VERSION}/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list \
&& \
add-apt-repository ppa:projectatomic/ppa \
curl -L ${REPOSITORY}/xUbuntu_${OS_VERSION}/Release.key | apt-key add - \
&& \
apt-get update \
&& \
apt-get install -y skopeo

RUN apt-get update \
&& \
apt-get install -y \
apt-transport-https \
curl \
&& \
curl https://pgrange.github.io/bash-unit_deb/keys.asc | apt-key add - \
&& \
echo deb https://pgrange.github.io/bash-unit_deb/debian/ unstable/ | \
tee -a /etc/apt/sources.list.d/bash-unit.list \
&& \
apt-get update \
&& \
apt-get install bash-unit
ARG ORAS_VERSION=0.12.0
RUN curl -#LO https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz \
&& \
tar -zxf oras_${ORAS_VERSION}_*.tar.gz -C /usr/local/bin/ oras \
&& \
rm oras_${ORAS_VERSION}_*.tar.gz

RUN [ "bash", "-c", "cd /usr/local/bin && bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh)" ]

COPY test.sh /
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -ue

python3 /static-container-registry.py /var/lib/images > /var/run/static-container-registry.conf
python3 /static_container_registry.py /var/lib/images > /var/run/static-container-registry.conf

exec "$@"
Loading

0 comments on commit d28febc

Please sign in to comment.