-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update release versioning and tagging
Signed-off-by: Utkarsh Bhatt <[email protected]>
- Loading branch information
1 parent
009d63e
commit 6f7475a
Showing
7 changed files
with
246 additions
and
100 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Release Ceph ROCKs | ||
# Runs whenever a new commit is pushed to below mentioned branches. | ||
on: | ||
push: | ||
branches: | ||
- 'stable/quincy' | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release_to_registry: | ||
name: Release Ceph Edge ROCK to GHCR | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
outputs: | ||
rock: ${{ steps.rockcraft.outputs.rock }} | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install deps and clean legacy rules. | ||
run: | | ||
sudo snap install lxd | ||
sudo snap install rockcraft --classic --edge | ||
sudo lxd init --auto | ||
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'-' -f0 <<< $PKG_VER) | ||
sed -i "/version/c\version: $CEPH_VER" rockcraft.yaml | ||
- 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: | | ||
# e.g. quincy-edge | ||
type=edge,prefix=quincy-,branch=stable/quincy | ||
- name: Prepare Rock | ||
uses: canonical/craft-actions/rockcraft-pack@main | ||
id: rockcraft | ||
|
||
- name: Load to Docker daemon | ||
run: | | ||
skopeo --insecure-policy copy oci-archive:${{ steps.rockcraft.outputs.rock }} docker-daemon:${{ steps.meta.outputs.tags }} | ||
docker image ls -a | ||
sleep 10 | ||
docker push ${{ steps.meta.outputs.tags }} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Publish Temporary ROCK | ||
|
||
on: | ||
pull_request: | ||
types: [ labeled ] | ||
|
||
jobs: | ||
hotfix_publish: | ||
name: Publish hotfix release | ||
# Run only if 'hotfix' label is attached. | ||
if: ${{ github.event.label.name == 'hotfix' }} | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
outputs: | ||
rock: ${{ steps.rockcraft.outputs.rock }} | ||
steps: | ||
- run: | | ||
echo Publishing container image for PR# $NUMBER | ||
env: | ||
NUMBER: ${{ github.event.pull_request.number }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Checkout Pull Request | ||
run: hub pr checkout ${{ github.event.pull_request.number }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install deps and clean legacy rules. | ||
run: | | ||
sudo snap install lxd | ||
sudo snap install rockcraft --classic --edge | ||
sudo lxd init --auto | ||
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 PR 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'-' -f0 <<< $PKG_VER) | ||
sed -i "/version:/c\version: $PR_NUM-$CEPH_VER" rockcraft.yaml | ||
echo "::set-output name=ceph_version::$CEPH_VER" | ||
env: | ||
PR_NUM: ${{ github.event.pull_request.number }} | ||
|
||
- 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: | | ||
# e.g. 31-17.2.6 based on $PR_NUM-$CEPH_VER | ||
type=raw,value=${{ github.event.pull_request.number }}-${{ steps.versioning.outputs.ceph_version }} | ||
- name: Prepare Rock | ||
uses: canonical/craft-actions/rockcraft-pack@main | ||
id: rockcraft | ||
|
||
- name: Load to Docker daemon | ||
run: | | ||
skopeo --insecure-policy copy oci-archive:${{ steps.rockcraft.outputs.rock }} docker-daemon:${{ steps.meta.outputs.tags }} | ||
docker image ls -a | ||
sleep 10 | ||
docker push ${{ steps.meta.outputs.tags }} | ||
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Release Ceph ROCKs | ||
# Only runs when a commit on release branches is tagged with ceph version string. | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'stable/quincy' | ||
tags: | ||
- v[1-9][0-9]\.[0-2]\.@([0-9]|[0-9][0-9]) # Version glob to match git tags with ceph versions | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release_to_registry: | ||
name: Release Ceph ROCK to GHCR | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
outputs: | ||
rock: ${{ steps.rockcraft.outputs.rock }} | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install deps and clean legacy rules. | ||
run: | | ||
sudo snap install lxd | ||
sudo snap install rockcraft --classic --edge | ||
sudo lxd init --auto | ||
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'-' -f0 <<< $PKG_VER) | ||
DEB_VER=$(cut -d'-' -f1 <<< $PKG_VER) | ||
sed -i "/version:/c\version: $CEPH_VER" rockcraft.yaml | ||
echo "::set-output name=ceph_version::$CEPH_VER" | ||
echo "::set-output name=deb_version::$DEB_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: | | ||
# e.g. 17.2.6, 18.2.1 based on ceph release. | ||
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{ steps.versioning.outputs.ceph_version }} | ||
# e.g. quincy, reef based on git branch (stable/quincy, stable/reef etc.) | ||
type=match,pattern=stable/v(.*),group=1,value=v1.0.0 | ||
# e.g. 0ubuntu0.22.04.1, 0ubuntu1 based on the package version | ||
type=raw,value=${{ steps.versioning.outputs.deb_version }} | ||
- name: Prepare Rock | ||
uses: canonical/craft-actions/rockcraft-pack@main | ||
id: rockcraft | ||
|
||
- name: Load to Docker daemon | ||
run: | | ||
skopeo --insecure-policy copy oci-archive:${{ steps.rockcraft.outputs.rock }} docker-daemon:${{ steps.meta.outputs.tags }} | ||
docker image ls -a | ||
sleep 10 | ||
docker push ${{ steps.meta.outputs.tags }} | ||
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Delete old container images | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 1 * *" # every day at midnight | ||
|
||
|
||
jobs: | ||
clean-ghcr: | ||
name: GHCR cleanup | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Delete all Hotfixes older than 2 months. | ||
uses: snok/container-retention-policy@v2 | ||
with: | ||
image-names: hotfix-* | ||
cut-off: Two months ago UTC | ||
timestamp-to-use: updated_at | ||
account-type: org | ||
org-name: canonical | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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