Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: create cosmic desktop base image #1

Merged
merged 8 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @p5
23 changes: 23 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",

// Use the basic Renovate preset, and allow settings to be overridden
"extends": [
"config:best-practices"
],

"packageRules": [
{
// Automatically update any GitHub Actions packages through minor and patch upgrades
"automerge": true,
"matchUpdateTypes": ["minor", "patch", "pin", "digest", "pinDigest"],
"matchManagers": [
"github-actions"
]
}
],

"dockerfile": {
"enabled": false
}
}
66 changes: 66 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build Images

on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: "0 */12 * * *"
workflow_dispatch:

env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
fedora-version: [40]
desktop-environment: [cosmic]
permissions:
contents: read
packages: write
id-token: write
env:
IMAGE_NAME: eternal-linux/base/${{ matrix.desktop-environment }}
FEDORA_VERSION: ${{ matrix.fedora-version }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Generate Image Tags
uses: rsturla/eternal-main/.github/actions/generate-image-tags@main
id: generate-image-tags
with:
image-name: ${{ env.IMAGE_REGISTRY}}/${{ env.IMAGE_NAME }}
major-version: ${{ env.FEDORA_VERSION }}
is-release: ${{ github.event_name != 'pull_request' }}

- name: Build Image
id: build
uses: rsturla/eternal-main/.github/actions/build-image@main
with:
builder: docker
context: ./desktop-environments/${{ matrix.desktop-environment }}
dockerfile: ./desktop-environments/${{ matrix.desktop-environment }}/Containerfile
image-name: ${{ env.IMAGE_NAME }}
image-tags: |
${{ steps.generate-image-tags.outputs.tags }}
build-args: |
FEDORA_VERSION=${{ env.FEDORA_VERSION }}

- name: Push Image
id: push
uses: rsturla/eternal-main/.github/actions/push-image@main
with:
builder: ${{ steps.build.outputs.builder }}
image-name: ${{ steps.build.outputs.image }}
image-tags: ${{ steps.build.outputs.tags }}
image-registry: ${{ env.IMAGE_REGISTRY }}
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Renovate CI

on:
pull_request:
paths:
- ".github/renovate.json5"
- ".github/workflows/renovate.yml"
push:
branches:
- main
paths:
- ".github/renovate.json5"
- ".github/workflows/renovate.yml"

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Validate Renovate Configuration
uses: rsturla/eternal-main/.github/actions/validate-renovate-config@main
20 changes: 20 additions & 0 deletions desktop-environments/cosmic/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ARG FEDORA_VERSION=40
ARG FEDORA_EDITION=base
ARG FEDORA_IMAGE=quay.io/fedora-ostree-desktops/${FEDORA_EDITION}:${FEDORA_VERSION}

FROM ${FEDORA_IMAGE}

COPY files/ /

RUN rpm-ostree install \
cosmic-desktop \
gnome-keyring

RUN rm -f /etc/systemd/system/display-manager.service && \
ln -s /usr/lib/systemd/system/cosmic-greeter.service /etc/systemd/system/display-manager.service \
&& \
systemctl enable greetd-workaround.service \
&& \
rpm-ostree cleanup -m && \
rm -rf /tmp/* /var/* && \
ostree container commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[copr:copr.fedorainfracloud.org:ryanabx:cosmic-epoch]
name=Copr repo for cosmic-epoch owned by ryanabx
baseurl=https://download.copr.fedorainfracloud.org/results/ryanabx/cosmic-epoch/fedora-$releasever-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/ryanabx/cosmic-epoch/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
Description=Workaround for SELinux issues for greetd
ConditionFileIsExecutable=/usr/bin/greetd
After=local-fs.target

[Service]
Type=oneshot
# Copy if it doesn't exist
ExecStartPre=/usr/bin/mkdir -p /usr/local/bin/overrides
ExecStartPre=/usr/bin/bash -c "[ -x /usr/local/bin/overrides/greetd ] || /usr/bin/cp /usr/bin/greetd /usr/local/bin/overrides/greetd"
# This is faster than using .mount unit. Also allows for the previous line/cleanup
ExecStartPre=/usr/bin/bash -c "/usr/bin/mount --bind /usr/local/bin/overrides/greetd /usr/bin/greetd"
# Fix caps
ExecStart=/usr/bin/bash -c "/usr/sbin/restorecon -rv /usr/bin/greetd"
# Clean-up after ourselves
ExecStop=/usr/bin/umount /usr/bin/greetd
ExecStop=/usr/bin/rm /usr/local/bin/overrides/greetd
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target