From ed4b2ab37c0edb5a420b2f18eb09a6b582c0b9a8 Mon Sep 17 00:00:00 2001 From: Kayra Date: Wed, 8 May 2024 15:09:09 +0300 Subject: [PATCH] build and verify rock --- .github/workflows/build-rock.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/build-rock.yaml b/.github/workflows/build-rock.yaml index a7eda9f..dbc809a 100644 --- a/.github/workflows/build-rock.yaml +++ b/.github/workflows/build-rock.yaml @@ -11,7 +11,35 @@ jobs: uses: actions/checkout@v4 - uses: canonical/craft-actions/rockcraft-pack@main id: rockcraft + + - name: Install Skopeo + run: | + sudo snap install skopeo --edge --devmode + - name: Import the image to Docker registry + run: | + sudo skopeo --insecure-policy copy oci-archive:${{ steps.rockcraft.outputs.rock }} docker-daemon:gocert:latest + - name: Create files required by GoCert + run: | + printf 'keypath: "/etc/config/key.pem"\ncertpath: "/etc/config/cert.pem"\ndbpath: "/etc/config/certs.db"\nport: 3000\n' > config.yaml + openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 1 -out cert.pem -subj "/CN=githubaction.example" + + - name: Run the image + run: | + docker run -d -p 3000:3000 --name gocert gocert:latest + docker cp ./ gocert:/etc/config + docker exec -it gocert /bin/pebble push -p /etc/config/cert.pem /etc/config/cert.pem + docker exec -it gocert /bin/pebble push -p /etc/config/key.pem /etc/config/key.pem + docker exec -it gocert /bin/pebble push -p /etc/config/config.yaml /etc/config/config.yaml + docker restart gocert + - name: Check if GoCert is successfully running + id: test_image + run: | + sleep 10 + curl -k https://localhost:3000 2>&1 | grep GoCert + - uses: actions/upload-artifact@v4 + if: steps.test_image.outcome == 'success' with: + name: rock path: ${{ steps.rockcraft.outputs.rock }}