Fixed Skopeo/Docker issues for Reef releases #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Ceph Rocks Edge | |
# Runs whenever a new commit is pushed to below mentioned branches. | |
on: | |
push: | |
branches: | |
- 'stable/*' | |
- 'main' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
release_to_registry: | |
name: Release Ceph Rocks Edge to GHCR | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: write | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Setup LXD | |
uses: canonical/[email protected] | |
with: | |
channel: 5.21/edge | |
- name: Install deps and clean legacy rules. | |
run: | | |
sudo snap install docker | |
sudo snap install rockcraft --classic --channel latest/stable | |
for ipt in iptables iptables-legacy ip6tables ip6tables-legacy; do sudo $ipt --flush; sudo $ipt --flush -t nat; sudo $ipt --delete-chain; sudo $ipt --delete-chain -t nat; sudo $ipt -P FORWARD ACCEPT; sudo $ipt -P INPUT ACCEPT; sudo $ipt -P OUTPUT ACCEPT; done | |
sudo systemctl reload snap.lxd.daemon | |
sleep 5 | |
- name: Patch version information into rock recipe | |
id: versioning | |
run: | | |
PKG_VER_STR=$(sudo rockcraft pull pkg_info -v &> >(grep "Version")) | |
PKG_VER=$(cut -d' ' -f3 <<< $PKG_VER_STR) | |
CEPH_VER=$(cut -d'-' -f1 <<< $PKG_VER) | |
sed -i "/version/c\version: $CEPH_VER" rockcraft.yaml | |
echo "::set-output name=ceph_version::$CEPH_VER" | |
- name: login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ghcr.io/canonical/ceph | |
tags: | | |
type=raw,value=quincy-edge,enable=${{ startsWith(steps.versioning.outputs.ceph_version, '17') }} | |
type=raw,value=reef-edge,enable=${{ startsWith(steps.versioning.outputs.ceph_version, '18') }} | |
type=raw,value=dev-edge,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
- name: Prepare Rock | |
uses: canonical/craft-actions/rockcraft-pack@main | |
id: rockcraft | |
- name: Load to Docker daemon | |
run: | | |
# iterate through the tags | |
for tag in $TAGS; do | |
echo "$tag" | |
docker image ls -a | |
docker import ${{ steps.rockcraft.outputs.rock }} $tag | |
done | |
docker image ls -a | |
sleep 10 | |
docker push ghcr.io/canonical/ceph --all-tags | |
env: | |
TAGS: ${{ steps.meta.outputs.tags }} | |