From 7251ac727eccad50f15ab167e96b04926ba4760d Mon Sep 17 00:00:00 2001 From: Gyanesh Mishra Date: Mon, 4 Dec 2023 22:29:56 -0800 Subject: [PATCH] Fix the state --- .github/workflows/build-soci.yaml | 138 ------------------------------ .github/workflows/build.yaml | 11 --- 2 files changed, 149 deletions(-) delete mode 100644 .github/workflows/build-soci.yaml diff --git a/.github/workflows/build-soci.yaml b/.github/workflows/build-soci.yaml deleted file mode 100644 index b86b4dc88..000000000 --- a/.github/workflows/build-soci.yaml +++ /dev/null @@ -1,138 +0,0 @@ -name: Build and push docker image with soci indexes to ghcr - -on: - workflow_dispatch: - push: - branches: - - 'INFRA-2132-soci' - -jobs: - build-and-push-image: - concurrency: - group: ${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - runs-on: a100-runner - permissions: - contents: write - packages: write - # This is used to complete the identity challenge - # with sigstore/fulcio when running outside of PRs. - id-token: write - security-events: write - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - android: true - dotnet: true - haskell: true - large-packages: false - swap-storage: true - - - name: Install soci - uses: lerentis/soci-installer@v1.0.1 - with: - soci-release: 'v0.4.0' - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2.1.0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.10.0 - - - name: Set up containerd for ubuntu - uses: crazy-max/ghaction-setup-containerd@v2.2.0 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ghcr.io/predibase/lorax - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=sha,prefix=,suffix=,format=short - type=raw,value=latest - - - name: Set output - id: vars - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Build Docker image - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile # Path to your Dockerfile - push: false - tags: ${{ steps.meta.outputs.tags }} - outputs: type=oci,dest=/tmp/lorax-${{ steps.vars.outputs.sha_short }}.tar - - - name: Import image in containerd - env: - sha_short: ${{ steps.vars.outputs.sha_short }} - run: | - echo "Importing $sha_short to GHCR" - sudo ctr i import --digests /tmp/lorax-$sha_short.tar - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_PAT }} - - - name: Push image with containerd - env: - tags: ${{ steps.meta.outputs.tags }} - run: | - for tag in $tags - do - echo "Pushing $tag to GHCR" - sudo ctr i push --user "${{ github.repository_owner }}:${{ secrets.GHCR_PAT }}" $tag - done - - - name: Create and push soci index - env: - tags: ${{ steps.meta.outputs.tags }} - run: | - export SOCI_PATH=$HOME/.soci/soci - for tag in $tags - do - echo "Creating soci index for $tag" - sudo $SOCI_PATH create $tag - echo "Pushing soci index for $tag" - sudo $SOCI_PATH push --user ${{ github.repository_owner }}:${{ secrets.GHCR_PAT }} $tag - done - - - name: Push image with containerd (again) to ensure latest tag is "latest" - env: - tags: ${{ steps.meta.outputs.tags }} - run: | - # We do this because if soci index is the last one pushed, it messes up the quick start on GHCR - for tag in $tags - do - echo "Pushing $tag to GHCR" - sudo ctr i push --user "${{ github.repository_owner }}:${{ secrets.GHCR_PAT }}" $tag - done - - - name: Prune older images - env: - sha_short: ${{ steps.vars.outputs.sha_short }} - run: | - # Delete images older than a day from docker store - docker image prune -a -f --filter "until=24h" - - # Delete the on disk copy - rm -rf "/tmp/lorax-$sha_short.tar" - - # Delete the SHA image(s) from containerd store - sudo ctr i rm $(sudo ctr i ls -q) - \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b1482c779..e481daa5a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -115,17 +115,6 @@ jobs: sudo $SOCI_PATH push --user ${{ github.repository_owner }}:${{ secrets.GHCR_PAT }} $tag done - - name: Push image with containerd (again) to ensure latest tag is "latest" - env: - tags: ${{ steps.meta.outputs.tags }} - run: | - # We do this because if soci index is the last one pushed, it messes up the quick start on GHCR - for tag in $tags - do - echo "Pushing $tag to GHCR" - sudo ctr i push --user "${{ github.repository_owner }}:${{ secrets.GHCR_PAT }}" $tag - done - - name: Prune older images env: sha_short: ${{ steps.vars.outputs.sha_short }}