Skip to content

Commit

Permalink
Merge pull request #6 from scality/improvement/PTFE-1367
Browse files Browse the repository at this point in the history
Migrate to ghcr
  • Loading branch information
francoisferrand authored Apr 11, 2024
2 parents 9755afa + 88e49d1 commit bc3db7e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
43 changes: 26 additions & 17 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ on:
- '**'

env:
DOCKER_IMAGE: registry.scality.com/static-container-registry-dev/static-container-registry
DOCKER_IMAGE: ghcr.io/${{ github.repository }}

jobs:
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.10"
#TODO: add annotations
Expand All @@ -29,20 +29,20 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

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

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

- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand All @@ -52,14 +52,14 @@ jobs:

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

- name: Install dependencies
run: |
OS=xUbuntu_20.04
CRIO_VERSION=1.21
CRIO_VERSION=1.23
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/ /"
Expand All @@ -68,17 +68,26 @@ jobs:
sudo apt-get update
sudo apt-get -y install cri-o cri-o-runc cri-tools hardlink
# Fix libpcre2-posix2 package version
sudo apt-get -y install --reinstall --allow-downgrades libpcre2-posix2/$(lsb_release -cs)
# Also need oras, skopeo ; but they are already installed
# Also need skopeo ; but it is already installed
bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh)
# Start cri-o service
sudo systemctl start crio
# Fix broken containerd setup
sudo containerd config default | sudo tee /etc/containerd/config.toml
sudo systemctl restart containerd
# TODO: cache the installed image?

- name: Downgrade Oras to 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/
rm -rf oras_${ORAS_VERSION}_*.tar.gz
env:
ORAS_VERSION: 0.12.0

- name: Unit testing with bash_unit
run: |
export IMAGE="${{ env.DOCKER_IMAGE }}:${{ github.sha }}"
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
name: release
run-name: release ${{ github.ref_name }}

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
uses: actions/checkout@v4

- name: Docker meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: env.DOCKER_IMAGE
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up Docker Buildk
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

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

- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand All @@ -46,8 +44,9 @@ jobs:
cache-to: type=gha,mode=max

- name: Create Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}

0 comments on commit bc3db7e

Please sign in to comment.