From fb02f19973e750b493bdb44124b66bfd8927bc74 Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Wed, 10 Apr 2024 14:51:54 +0200 Subject: [PATCH 1/6] Migrate to ghcr Issue: PTFE-1367 --- .github/workflows/build.yaml | 8 ++++---- .github/workflows/release.yaml | 12 +++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4b3c6f1..3b1e5e4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -6,7 +6,7 @@ on: - '**' env: - DOCKER_IMAGE: registry.scality.com/static-container-registry-dev/static-container-registry + DOCKER_IMAGE: ghcr.io/${{ github.repository }} jobs: pylint: @@ -37,9 +37,9 @@ jobs: - name: Login to Registry uses: docker/login-action@v1 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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 51d5036..cc607f7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,13 +1,11 @@ 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 @@ -18,7 +16,7 @@ jobs: - name: Docker meta uses: docker/metadata-action@v3 with: - images: env.DOCKER_IMAGE + images: ghcr.io/${{ github.repository }} tags: | type=ref,event=branch type=ref,event=pr @@ -31,9 +29,9 @@ jobs: - name: Login to Registry uses: docker/login-action@v1 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 From b38cec44621276ae2d0ae36b4ac5d0f34564f2e0 Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Wed, 10 Apr 2024 14:53:46 +0200 Subject: [PATCH 2/6] Bump github actions - build-push-action@v5 - checkout@v4 - gh-release@v2 - login@v3 - metadata@v4 - setup-python@v5 - setup-buildx@v43 Issue: PTFE-1367 --- .github/workflows/build.yaml | 14 +++++++------- .github/workflows/release.yaml | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3b1e5e4..b7c1250 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -12,9 +12,9 @@ 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 @@ -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: 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 @@ -54,7 +54,7 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install dependencies run: | diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index cc607f7..f449b90 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,10 +11,10 @@ jobs: 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: ghcr.io/${{ github.repository }} tags: | @@ -24,17 +24,17 @@ jobs: 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: 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 @@ -44,7 +44,7 @@ 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: From 368c4e4ad2c8bd0ea68c5ddd4a81bbcae65a444b Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Wed, 10 Apr 2024 14:58:44 +0200 Subject: [PATCH 3/6] Pin ubuntu env to fix tests Issue: PTFE-1367 --- .github/workflows/build.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b7c1250..0b00dd7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -52,14 +52,14 @@ jobs: test: needs: build - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - 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/ /" @@ -68,9 +68,6 @@ 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 bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh) From 6c61f48a697a16e1b23416f9fcc4e0f80fee93d1 Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Thu, 11 Apr 2024 01:00:23 +0200 Subject: [PATCH 4/6] Pin older oras version to fix tests Issue: PTFE-1367 --- .github/workflows/build.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0b00dd7..9ea20a9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -68,7 +68,7 @@ jobs: sudo apt-get update sudo apt-get -y install cri-o cri-o-runc cri-tools hardlink - # 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) @@ -76,6 +76,14 @@ jobs: sudo systemctl start crio # 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 }}" From ff41b165732b403215a369bac2d64862308c7c0d Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Thu, 11 Apr 2024 01:00:40 +0200 Subject: [PATCH 5/6] Fix release name Issue: PTFE-1367 --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f449b90..e7ffccf 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -49,3 +49,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref_name }} + name: Release ${{ github.ref_name }} From 88e49d14159c5a65e8da6ed610a4196336eb1f7a Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Thu, 11 Apr 2024 09:48:17 +0200 Subject: [PATCH 6/6] Fix containerd setup Somehow the containerd config in the runner is broken, which may be related to the docker install. This can be fixed by resetting the config, as suggested in [1]. [1] https://serverfault.com/a/108911 Issue: PTFE-1367 --- .github/workflows/build.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9ea20a9..58725f3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -74,6 +74,10 @@ jobs: # 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