From 94442ca7ab3fc058b04e5b12da21a973b1a639af Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 16:10:58 -0400 Subject: [PATCH 01/12] Added packages to release for ubuntu-20.04 only. --- .github/workflows/release.yml | 43 ++++++++++++++++++- .../ci/Dockerfile.bundle-test-ubuntu-20-04 | 2 + 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87151a23558d..6be2f5633611 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,7 +72,7 @@ jobs: uses: ./.github/actions/setup with: os: ${{ matrix.os }} - + - name: Build release bundle run: | cargo run -p make-kani-release -- ${{ needs.Release.outputs.version }} @@ -86,3 +86,44 @@ jobs: asset_path: kani-${{ needs.Release.outputs.version }}-${{ matrix.target }}.tar.gz asset_name: kani-${{ needs.Release.outputs.version }}-${{ matrix.target }}.tar.gz asset_content_type: application/gzip + + Package-Docker: + name: 'Package Docker' + needs: Release + runs-on: ubuntu-20.04 + permissions: + contents: write + strategy: + os: ubuntu-20.04 + target: x86_64-unknown-linux-gnu + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Kani Dependencies + uses: ./.github/actions/setup + with: + os: ubuntu-20.04 + + - name: 'Build release bundle' + run: | + cargo run -p make-kani-release -- ${{ needs.Release.outputs.version }} + + - name: 'Login to GitHub Container Registry' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: model-checking + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + registry: ghcr.io + context: . + file: scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 + push: true + github-token: ${{ secrets.GITHUB_TOKEN }} + tags: | + ghcr.io/model-checking/kani-${{ matrix.target }}:${{ needs.Release.outputs.version }} + ghcr.io/model-checking/kani-${{ matrix.target }}:latest diff --git a/scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 b/scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 index f2516acd6f48..3c1e0e44d43f 100644 --- a/scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 +++ b/scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 @@ -18,3 +18,5 @@ COPY ./kani-latest-x86_64-unknown-linux-gnu.tar.gz ./ COPY ./target/package/kani-verifier-*[^e] ./kani-verifier RUN cargo install --path ./kani-verifier RUN cargo-kani setup --use-local-bundle ./kani-latest-x86_64-unknown-linux-gnu.tar.gz + +LABEL org.opencontainers.image.source https://github.com/model-checking/kani From e336cc03c37af068cb18f808a44afc32747de9ca Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 21:09:49 -0400 Subject: [PATCH 02/12] Reduced image size. --- .github/workflows/release.yml | 2 +- scripts/ci/Dockerfile.bundle-release-20-04 | 29 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 scripts/ci/Dockerfile.bundle-release-20-04 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6be2f5633611..4ac7c4e379af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -121,7 +121,7 @@ jobs: with: registry: ghcr.io context: . - file: scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 + file: scripts/ci/Dockerfile.bundle-release-20-04 push: true github-token: ${{ secrets.GITHUB_TOKEN }} tags: | diff --git a/scripts/ci/Dockerfile.bundle-release-20-04 b/scripts/ci/Dockerfile.bundle-release-20-04 new file mode 100644 index 000000000000..760ecfcbd789 --- /dev/null +++ b/scripts/ci/Dockerfile.bundle-release-20-04 @@ -0,0 +1,29 @@ +# Copyright Kani Contributors +# SPDX-License-Identifier: Apache-2.0 OR MIT + +# Docker image for Kani GitHub Package release ubuntu-20-04. + +FROM ubuntu:20.04 +ENV DEBIAN_FRONTEND=noninteractive \ + DEBCONF_NONINTERACTIVE_SEEN=true \ + PATH="/root/.cargo/bin:${PATH}" +WORKDIR /tmp/kani +COPY ./kani-latest-x86_64-unknown-linux-gnu.tar.gz ./ +# Very awkward glob (not regex!) to get `kani-verifier-*` and not `kani-verifier-*.crate` +COPY ./target/package/kani-verifier-*[^e] ./kani-verifier + +# Install Kani and dependencies. We will install the required +# toolchain by running an empty cargo command inside kani release +# directory. Rustup is purged for space. + +RUN apt-get update && \ + apt-get install -y python3 python3-pip curl ctags && \ + curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none && \ + (cd kani-verifier/; cargo) && \ + rustup default $(rustup toolchain list | awk '{ print $1 }') && \ + cargo install --path ./kani-verifier && \ + cargo-kani setup --use-local-bundle ./kani-latest-x86_64-unknown-linux-gnu.tar.gz && \ + apt-get clean && \ + rm -rf /tmp/kani/* /root/.rustup/toolchains/*/share + +LABEL org.opencontainers.image.source https://github.com/model-checking/kani From 53bfe604f3757ff11b67fd41ffa35bdce8eb75e4 Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 21:10:54 -0400 Subject: [PATCH 03/12] Changed from matrix. --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4ac7c4e379af..70b2134ca6c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -93,7 +93,7 @@ jobs: runs-on: ubuntu-20.04 permissions: contents: write - strategy: + env: os: ubuntu-20.04 target: x86_64-unknown-linux-gnu steps: @@ -125,5 +125,5 @@ jobs: push: true github-token: ${{ secrets.GITHUB_TOKEN }} tags: | - ghcr.io/model-checking/kani-${{ matrix.target }}:${{ needs.Release.outputs.version }} - ghcr.io/model-checking/kani-${{ matrix.target }}:latest + ghcr.io/model-checking/kani-${{ os }}:${{ needs.Release.outputs.version }} + ghcr.io/model-checking/kani-${{ os }}:latest From 8d7a571b651a6fb5c8c915ffe408e72269355ee6 Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 21:26:03 -0400 Subject: [PATCH 04/12] Missing path in variable invocation. --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 70b2134ca6c7..b58401a0a816 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,5 +125,5 @@ jobs: push: true github-token: ${{ secrets.GITHUB_TOKEN }} tags: | - ghcr.io/model-checking/kani-${{ os }}:${{ needs.Release.outputs.version }} - ghcr.io/model-checking/kani-${{ os }}:latest + ghcr.io/model-checking/kani-${{ env.os }}:${{ needs.Release.outputs.version }} + ghcr.io/model-checking/kani-${{ env.os }}:latest From ea9f5da4801f37efe37157b29882fbbeaf9367d9 Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 21:42:20 -0400 Subject: [PATCH 05/12] Copy without version dependence. --- scripts/ci/Dockerfile.bundle-release-20-04 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/Dockerfile.bundle-release-20-04 b/scripts/ci/Dockerfile.bundle-release-20-04 index 760ecfcbd789..e0e697c7e8cd 100644 --- a/scripts/ci/Dockerfile.bundle-release-20-04 +++ b/scripts/ci/Dockerfile.bundle-release-20-04 @@ -8,7 +8,7 @@ ENV DEBIAN_FRONTEND=noninteractive \ DEBCONF_NONINTERACTIVE_SEEN=true \ PATH="/root/.cargo/bin:${PATH}" WORKDIR /tmp/kani -COPY ./kani-latest-x86_64-unknown-linux-gnu.tar.gz ./ +COPY ./kani-*-x86_64-unknown-linux-gnu.tar.gz ./kani-latest-x86_64-unknown-linux-gnu.tar.gz # Very awkward glob (not regex!) to get `kani-verifier-*` and not `kani-verifier-*.crate` COPY ./target/package/kani-verifier-*[^e] ./kani-verifier From 7ab184b16ca652c34e4b8bca07e47c792cb53d2e Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 22:22:45 -0400 Subject: [PATCH 06/12] Eliminated hard-coded values --- .github/workflows/release.yml | 6 +++++- scripts/ci/Dockerfile.bundle-release-20-04 | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b58401a0a816..4f90871aa877 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -113,7 +113,7 @@ jobs: uses: docker/login-action@v2 with: registry: ghcr.io - username: model-checking + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push @@ -127,3 +127,7 @@ jobs: tags: | ghcr.io/model-checking/kani-${{ env.os }}:${{ needs.Release.outputs.version }} ghcr.io/model-checking/kani-${{ env.os }}:latest + labels: | + org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.version=${{ needs.Release.outputs.version }} + org.opencontainers.image.licenses=Apache-2.0 OR MIT diff --git a/scripts/ci/Dockerfile.bundle-release-20-04 b/scripts/ci/Dockerfile.bundle-release-20-04 index e0e697c7e8cd..33baaaf04b1e 100644 --- a/scripts/ci/Dockerfile.bundle-release-20-04 +++ b/scripts/ci/Dockerfile.bundle-release-20-04 @@ -25,5 +25,3 @@ RUN apt-get update && \ cargo-kani setup --use-local-bundle ./kani-latest-x86_64-unknown-linux-gnu.tar.gz && \ apt-get clean && \ rm -rf /tmp/kani/* /root/.rustup/toolchains/*/share - -LABEL org.opencontainers.image.source https://github.com/model-checking/kani From 377f540a871a076417e6c6a953b0d0fa0ec340f4 Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 22:35:38 -0400 Subject: [PATCH 07/12] Removed redundant input. --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f90871aa877..8ad0f918be24 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -119,7 +119,6 @@ jobs: - name: Build and push uses: docker/build-push-action@v3 with: - registry: ghcr.io context: . file: scripts/ci/Dockerfile.bundle-release-20-04 push: true From 7236a69c9fbe7a71067c9700a1d9c50cd6380ec3 Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 22:59:30 -0400 Subject: [PATCH 08/12] Added missing package command. --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8ad0f918be24..b5005fbdee04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -108,6 +108,7 @@ jobs: - name: 'Build release bundle' run: | cargo run -p make-kani-release -- ${{ needs.Release.outputs.version }} + cargo package -p kani-verifier - name: 'Login to GitHub Container Registry' uses: docker/login-action@v2 From 9661ee72234ba53148a3f2ae7a594ff9c10fd07c Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 23:08:55 -0400 Subject: [PATCH 09/12] Forgot to make owner flexible. --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b5005fbdee04..082aef5c7956 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,8 +125,8 @@ jobs: push: true github-token: ${{ secrets.GITHUB_TOKEN }} tags: | - ghcr.io/model-checking/kani-${{ env.os }}:${{ needs.Release.outputs.version }} - ghcr.io/model-checking/kani-${{ env.os }}:latest + ghcr.io/${{ github.repository_owner }}/kani-${{ env.os }}:${{ needs.Release.outputs.version }} + ghcr.io/${{ github.repository_owner }}/kani-${{ env.os }}:latest labels: | org.opencontainers.image.source=${{ github.repositoryUrl }} org.opencontainers.image.version=${{ needs.Release.outputs.version }} From 31100e48b67216faab7f911b5842c3a240f0f27b Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 23:21:49 -0400 Subject: [PATCH 10/12] Fixed docker push fail: uppercase in name. --- .github/workflows/release.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 082aef5c7956..88826b3a9815 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -117,6 +117,12 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: 'Set lower case owner name. Needed for docker push.' + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' + - name: Build and push uses: docker/build-push-action@v3 with: @@ -125,8 +131,8 @@ jobs: push: true github-token: ${{ secrets.GITHUB_TOKEN }} tags: | - ghcr.io/${{ github.repository_owner }}/kani-${{ env.os }}:${{ needs.Release.outputs.version }} - ghcr.io/${{ github.repository_owner }}/kani-${{ env.os }}:latest + ghcr.io/${{ env.OWNER_LC }}/kani-${{ env.os }}:${{ needs.Release.outputs.version }} + ghcr.io/${{ env.OWNER_LC }}/kani-${{ env.os }}:latest labels: | org.opencontainers.image.source=${{ github.repositoryUrl }} org.opencontainers.image.version=${{ needs.Release.outputs.version }} From ed454b386997ef6b5f67c11fa70a20ee0e441005 Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Fri, 26 Aug 2022 23:38:05 -0400 Subject: [PATCH 11/12] Missing permissions. --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88826b3a9815..c19362c33bd8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -93,6 +93,7 @@ jobs: runs-on: ubuntu-20.04 permissions: contents: write + packages: write env: os: ubuntu-20.04 target: x86_64-unknown-linux-gnu From 36e438f78bba5a287d5023898a379c8c42eaf7f5 Mon Sep 17 00:00:00 2001 From: Yoshi Takashima Date: Mon, 29 Aug 2022 15:44:38 -0400 Subject: [PATCH 12/12] Reverted unrelated testbundle Dockerfile --- scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 b/scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 index 3c1e0e44d43f..f2516acd6f48 100644 --- a/scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 +++ b/scripts/ci/Dockerfile.bundle-test-ubuntu-20-04 @@ -18,5 +18,3 @@ COPY ./kani-latest-x86_64-unknown-linux-gnu.tar.gz ./ COPY ./target/package/kani-verifier-*[^e] ./kani-verifier RUN cargo install --path ./kani-verifier RUN cargo-kani setup --use-local-bundle ./kani-latest-x86_64-unknown-linux-gnu.tar.gz - -LABEL org.opencontainers.image.source https://github.com/model-checking/kani