Skip to content

Commit

Permalink
build and verify rock
Browse files Browse the repository at this point in the history
  • Loading branch information
kayra1 committed May 8, 2024
1 parent 2ccc414 commit ed4b2ab
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build-rock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit ed4b2ab

Please sign in to comment.