Skip to content

Commit

Permalink
Merge branch '8.0-22.04' of github.com:canonical/charmed-mysql-rock i…
Browse files Browse the repository at this point in the history
…nto test/add-trivy
  • Loading branch information
paulomach committed Aug 16, 2024
2 parents e5e04cb + 00504bb commit 6752af4
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 183 deletions.
32 changes: 27 additions & 5 deletions .github/workflows/check_version.yaml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
name: Check Version
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
name: Tests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install tox
run: pipx install tox
- name: Run linters
run: tox run -e lint

check-version:
name: Check version
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: 'Foresight: Collect workflow telemetry'
uses: runforesight/foresight-workflow-kit-action@v1
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- name: Install yq
run: sudo snap install yq
- name: Compare versions
Expand All @@ -27,3 +45,7 @@ jobs:
echo "SNAP version: $SNAP_VERSION"
exit 1
fi
build:
name: Build rock
uses: canonical/data-platform-workflows/.github/workflows/build_rock.yaml@v17
41 changes: 0 additions & 41 deletions .github/workflows/integration.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/lint.yaml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
name: Release to GHCR

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- 8.0-22.04
workflow_dispatch:

jobs:
build:
name: Build rock
uses: canonical/data-platform-workflows/.github/workflows/build_rock.yaml@v17

release:
name: Release rock
needs:
- build
uses: canonical/data-platform-workflows/.github/workflows/release_rock.yaml@v17
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
permissions:
packages: write # Needed to publish to GitHub Container Registry
contents: write # Needed to create GitHub release

sbom:
name: Generate Software Bill of Materials
needs:
- build
# Run after release so that rock cannot be (maliciously) modified between build & release
- release
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Install Syft
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Download rock package(s)
uses: actions/download-artifact@v4
with:
pattern: ${{ needs.build.outputs.artifact-prefix }}-*
merge-multiple: true
- name: Generate SBOM(s)
shell: python
run: |
import pathlib
import subprocess
for rock_file in pathlib.Path(".").glob("*.rock"):
subprocess.run(
["syft", rock_file.name, "--output", f"spdx-json={rock_file.name}.spdx.json"],
check=True,
)
- name: Upload SBOM(s)
uses: actions/upload-artifact@v4
with:
name: sbom-${{ needs.build.outputs.artifact-prefix }}
path: '*.spdx.json'
if-no-files-found: error
2 changes: 1 addition & 1 deletion .github/workflows/sync_issue_to_jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
sync:
name: Sync GitHub issue to Jira
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v2
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v17
with:
jira-base-url: https://warthogs.atlassian.net
jira-project-key: DPE
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# MySQL Server ROCK
[![Release to GHCR](https://github.com/canonical/charmed-mysql-rock/actions/workflows/release.yaml/badge.svg)](https://github.com/canonical/charmed-mysql-rock/actions/workflows/release.yaml)

This repository contains the packaging metadata for creating a ROCK of MySQL built from the official ubuntu MySQL package from the Ubuntu repository and further installs mysql-shell. For more information on ROCKs, visit the [rockcraft Github](https://github.com/canonical/rockcraft).

Built for use in the [MySQL k8s charm](https://github.com/canonical/mysql-k8s-operator).
Expand Down
37 changes: 7 additions & 30 deletions rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: charmed-mysql # the name of your ROCK
base: [email protected] # the base environment for this ROCK
version: '8.0.34' # just for humans. Semantic versioning is recommended
summary: Charmed MySQL ROCK OCI # 79 char long summary
name: charmed-mysql
base: [email protected]
version: '8.0.37'
summary: Charmed MySQL ROCK OCI
description: |
MySQL built from the official MySQL package
from the MySQL repository and installs
mysql-shell. For more information on ROCKs, visit
the https://github.com/canonical/rockcraft.
license: Apache-2.0 # your application's SPDX license
platforms: # The platforms this ROCK should be built on and run on
license: Apache-2.0
platforms:
amd64:
arm64:

parts:
charmed-mysql:
Expand All @@ -32,30 +33,6 @@ parts:
- python3-yaml
stage-snaps:
- charmed-mysql/8.0/edge
override-stage: |
LIB_DIR=$CRAFT_STAGE/usr/lib/x86_64-linux-gnu
craftctl default
mkdir -p $CRAFT_STAGE/var/lib/mysql
ln -sf $LIB_DIR/libnuma.so.1 \
/usr/lib/x86_64-linux-gnu/libnuma.so.1
ln -sf $LIB_DIR/libaio.so.1 \
/usr/lib/x86_64-linux-gnu/libaio.so.1
ln -sf $LIB_DIR/libicuuc.so.70 \
/usr/lib/x86_64-linux-gnu/libicuuc.so.70
ln -sf $LIB_DIR/libicui18n.so.70 \
/usr/lib/x86_64-linux-gnu/libicui18n.so.70
ln -sf $LIB_DIR/libevent_core-2.1.so.7 \
/usr/lib/x86_64-linux-gnu/libevent_core-2.1.so.7
ln -sf $LIB_DIR/libevent_pthreads-2.1.so.7 \
/usr/lib/x86_64-linux-gnu/libevent_pthreads-2.1.so.7
ln -sf $LIB_DIR/libprotobuf-lite.so.23 \
/usr/lib/x86_64-linux-gnu/libprotobuf-lite.so.23
ln -sf $LIB_DIR/libicudata.so.70 \
/usr/lib/x86_64-linux-gnu/libicudata.so.70
rm -rf /var/lib/mysql/
mysqld --initialize
cp -r /var/lib/mysql $CRAFT_STAGE/var/lib
chown 584788:584788 $CRAFT_STAGE/var/lib/mysql
override-prime: |
craftctl default
mv -f $CRAFT_PRIME/etc/mysql/mysql.cnf $CRAFT_PRIME/etc/mysql/my.cnf
Expand Down
91 changes: 1 addition & 90 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
[tox]
requires =
tox>=4
env_list = lint, integration

[testenv]
setenv =
repo=https://github.com/canonical/mysql-k8s-operator.git
base-name=ghcr.io/canonical/charmed-mysql
env_list = lint

[testenv:lint]
description = run linters
Expand All @@ -15,87 +10,3 @@ deps =
yamllint
commands =
yamllint --no-warnings rockcraft.yaml

[testenv:integration-charm]
description = run operator integration tests
skip_install = true
allowlist_externals =
tox
bash
commands =
bash -ec 'if ! [ -f charmed-mysql_*_amd64.rock ]; then rockcraft pack; fi' {posargs}
bash -ec 'microk8s ctr image import charmed-mysql_*_amd64.rock --base-name {env:base-name}'
bash -ec 'if ! [ -d operator ]; then git clone {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e integration-charm

[testenv:integration-database-relation]
description = run operator integration tests
skip_install = true
allowlist_externals =
tox
bash
commands =
bash -ec 'if ! [ -f charmed-mysql_*_amd64.rock ]; then rockcraft pack; fi' {posargs}
bash -ec 'microk8s ctr image import charmed-mysql_*_amd64.rock --base-name {env:base-name}'
bash -ec 'if ! [ -d operator ]; then git clone {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e integration-database-relation

[testenv:integration-osm-mysql]
description = run operator integration tests
skip_install = true
allowlist_externals =
tox
bash
commands =
bash -ec 'if ! [ -f charmed-mysql_*_amd64.rock ]; then rockcraft pack; fi' {posargs}
bash -ec 'microk8s ctr image import charmed-mysql_*_amd64.rock --base-name {env:base-name}'
bash -ec 'if ! [ -d operator ]; then git clone {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e integration-osm-mysql

[testenv:integration-replication]
description = run operator integration tests
skip_install = true
allowlist_externals =
tox
bash
commands =
bash -ec 'if ! [ -f charmed-mysql_*_amd64.rock ]; then rockcraft pack; fi' {posargs}
bash -ec 'microk8s ctr image import charmed-mysql_*_amd64.rock --base-name {env:base-name}'
bash -ec 'if ! [ -d operator ]; then git clone {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e integration-replication

[testenv:integration-self-healing]
description = run operator integration tests
skip_install = true
allowlist_externals =
tox
bash
commands =
bash -ec 'if ! [ -f charmed-mysql_*_amd64.rock ]; then rockcraft pack; fi' {posargs}
bash -ec 'microk8s ctr image import charmed-mysql_*_amd64.rock --base-name {env:base-name}'
bash -ec 'if ! [ -d operator ]; then git clone {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e integration-self-healing

[testenv:integration-tls]
description = run operator integration tests
skip_install = true
allowlist_externals =
tox
bash
commands =
bash -ec 'if ! [ -f charmed-mysql_*_amd64.rock ]; then rockcraft pack; fi' {posargs}
bash -ec 'microk8s ctr image import charmed-mysql_*_amd64.rock --base-name {env:base-name}'
bash -ec 'if ! [ -d operator ]; then git clone {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e integration-tls

[testenv:integration-backups]
description = run operator integration tests
skip_install = true
allowlist_externals =
tox
bash
commands =
bash -ec 'if ! [ -f charmed-mysql_*_amd64.rock ]; then rockcraft pack; fi' {posargs}
bash -ec 'microk8s ctr image import charmed-mysql_*_amd64.rock --base-name {env:base-name}'
bash -ec 'if ! [ -d operator ]; then git clone {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e integration-backups

0 comments on commit 6752af4

Please sign in to comment.