From a244dc81b509ea5e10f38ec49eb0b73914592ca5 Mon Sep 17 00:00:00 2001 From: Cappy Ishihara Date: Mon, 10 Oct 2022 08:36:05 +0700 Subject: [PATCH] add moby-extras --- .github/workflows/autobuild.yml | 89 +++++++++++++++++++ .github/workflows/mass-rebuild.yml | 83 +++++++++++++++++ anda.hcl | 1 + anda/moby-extras/moby-buildx/anda.hcl | 6 ++ anda/moby-extras/moby-buildx/moby-buildx.spec | 42 +++++++++ anda/moby-extras/moby-compose/anda.hcl | 6 ++ .../moby-compose/moby-compose.spec | 43 +++++++++ 7 files changed, 270 insertions(+) create mode 100644 .github/workflows/autobuild.yml create mode 100644 .github/workflows/mass-rebuild.yml create mode 100644 anda.hcl create mode 100644 anda/moby-extras/moby-buildx/anda.hcl create mode 100644 anda/moby-extras/moby-buildx/moby-buildx.spec create mode 100644 anda/moby-extras/moby-compose/anda.hcl create mode 100644 anda/moby-extras/moby-compose/moby-compose.spec diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml new file mode 100644 index 0000000000..6e5040dec0 --- /dev/null +++ b/.github/workflows/autobuild.yml @@ -0,0 +1,89 @@ +# for each folder in anda/ +# generate a new workflow for each folder in anda/ +name: Automatically build packages +on: + + push: + paths: + - anda/** + branches: + - main + workflow_dispatch: + +jobs: + manifest: + runs-on: ubuntu-latest + + outputs: + build_matrix: ${{ steps.generate_build_matrix.outputs.build_matrix }} + is_empty: ${{ steps.generate_build_matrix.outputs.is_empty }} + + # check out the repo + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + - run: git fetch + #- run: git checkout HEAD^ + + - name: Generate Build matrix + id: generate_build_matrix + # generate build matrix by checking out changes in anda/ + run: | + # get the list of changed folders in the current commit + changed_folders=$(git diff --name-only HEAD^ | grep -oP 'anda/\K[^/]*' | sort -u ) + echo "Changed folders: $changed_folders" + # if changed_folders is empty then set is empty to true + if [ -z "$changed_folders" ]; then + echo "::set-output name=is_empty::true" + else + echo "::set-output name=is_empty::false" + fi + # turn it into a json array + build_matrix=$(echo "$changed_folders" | jq -R . | jq -s . | jq -c .) + + # if there's only one folder then check if it's + + #build_matrix=$(ls anda/ | jq -R -s -c 'split("\n")[:-1]') + # create build matrix with { changed_folders: [ "folder1", "folder2" ] } + + echo "::set-output name=build_matrix::$build_matrix" + #echo "::set-output name=build_matrix::$build_matrix" + build: + needs: manifest + strategy: + matrix: + pkg: ${{ fromJson(needs.manifest.outputs.build_matrix) }} + version: ["ad37"] + arch: ["x86_64", "aarch64"] + fail-fast: false + #if: ${{ matrix.changed_folders != '' }} + runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }} + container: + image: registry.fedoraproject.org/fedora:37 + options: --cap-add=SYS_ADMIN --privileged + steps: + - name: Install repositories + run: | + sudo dnf install -y dnf-plugins-core + sudo dnf config-manager --add-repo https://github.com/andaman-common-pkgs/subatomic-repos/raw/main/ad37.repo + sudo dnf install -y anda-mock-configs subatomic-cli anda mock rpm-build + + - uses: andaman-common-pkgs/anda-build@main + if: ${{ !fromJson(needs.manifest.outputs.is_empty) }} + with: + name: "anda/${{ matrix.pkg }}/pkg" + mockConfig: anda-37-${{ matrix.arch }} + andaRepo: https://github.com/andaman-common-pkgs/subatomic-repos/raw/main/ad37.repo + + - name: Install Subatomic client + run: sudo dnf install -y subatomic-cli + + - name: Upload packages to subatomic + if: ${{ !fromJson(needs.manifest.outputs.is_empty) }} + run: | + subatomic-cli upload --prune \ + --server https://subatomic.fyralabs.com \ + --token ${{ secrets.SUBATOMIC_TOKEN }} \ + ${{ matrix.version }} anda-build/rpm/rpms/* \ No newline at end of file diff --git a/.github/workflows/mass-rebuild.yml b/.github/workflows/mass-rebuild.yml new file mode 100644 index 0000000000..3c475efba6 --- /dev/null +++ b/.github/workflows/mass-rebuild.yml @@ -0,0 +1,83 @@ +# for each folder in anda/ +# generate a new workflow for each folder in anda/ +name: Automatically build packages +on: + workflow_dispatch: + +jobs: + manifest: + runs-on: ubuntu-latest + + outputs: + build_matrix: ${{ steps.generate_build_matrix.outputs.build_matrix }} + is_empty: ${{ steps.generate_build_matrix.outputs.is_empty }} + + # check out the repo + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + - run: git fetch + #- run: git checkout HEAD^ + + - name: Generate Build matrix + id: generate_build_matrix + # generate build matrix by checking out changes in anda/ + run: | + # get the list of changed folders in the current commit + changed_folders=$(git diff --name-only HEAD^ | grep -oP 'anda/\K[^/]*' | sort -u ) + echo "Changed folders: $changed_folders" + # if changed_folders is empty then set is empty to true + if [ -z "$changed_folders" ]; then + echo "::set-output name=is_empty::true" + else + echo "::set-output name=is_empty::false" + fi + # turn it into a json array + #build_matrix=$(echo "$changed_folders" | jq -R . | jq -s . | jq -c .) + + # if there's only one folder then check if it's + + build_matrix=$(ls anda/ | jq -R -s -c 'split("\n")[:-1]') + # create build matrix with { changed_folders: [ "folder1", "folder2" ] } + + echo "::set-output name=build_matrix::$build_matrix" + #echo "::set-output name=build_matrix::$build_matrix" + build: + needs: manifest + strategy: + matrix: + pkg: ${{ fromJson(needs.manifest.outputs.build_matrix) }} + version: ["ad37"] + arch: ["x86_64", "aarch64"] + fail-fast: false + #if: ${{ matrix.changed_folders != '' }} + runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }} + container: + image: registry.fedoraproject.org/fedora:37 + options: --cap-add=SYS_ADMIN --privileged + steps: + - name: Install repositories + run: | + sudo dnf install -y dnf-plugins-core + sudo dnf config-manager --add-repo https://github.com/andaman-common-pkgs/subatomic-repos/raw/main/ad37.repo + sudo dnf install -y anda-mock-configs subatomic-cli anda mock rpm-build + + - uses: andaman-common-pkgs/anda-build@main + if: ${{ !fromJson(needs.manifest.outputs.is_empty) }} + with: + name: "anda/${{ matrix.pkg }}/pkg" + mockConfig: anda-37-${{ matrix.arch }} + andaRepo: https://github.com/andaman-common-pkgs/subatomic-repos/raw/main/ad37.repo + + - name: Install Subatomic client + run: sudo dnf install -y subatomic-cli + + - name: Upload packages to subatomic + if: ${{ !fromJson(needs.manifest.outputs.is_empty) }} + run: | + subatomic-cli upload --prune \ + --server https://subatomic.fyralabs.com \ + --token ${{ secrets.SUBATOMIC_TOKEN }} \ + ${{ matrix.version }} anda-build/rpm/rpms/* \ No newline at end of file diff --git a/anda.hcl b/anda.hcl new file mode 100644 index 0000000000..59eec05f48 --- /dev/null +++ b/anda.hcl @@ -0,0 +1 @@ +project {} \ No newline at end of file diff --git a/anda/moby-extras/moby-buildx/anda.hcl b/anda/moby-extras/moby-buildx/anda.hcl new file mode 100644 index 0000000000..3c7af3dc26 --- /dev/null +++ b/anda/moby-extras/moby-buildx/anda.hcl @@ -0,0 +1,6 @@ +project "pkg" { + rpm { + spec = "moby-buildx.spec" + sources = "." + } +} \ No newline at end of file diff --git a/anda/moby-extras/moby-buildx/moby-buildx.spec b/anda/moby-extras/moby-buildx/moby-buildx.spec new file mode 100644 index 0000000000..6af5861218 --- /dev/null +++ b/anda/moby-extras/moby-buildx/moby-buildx.spec @@ -0,0 +1,42 @@ +%define debug_package %{nil} + +Name: moby-buildx +Version: 0.9.1 +Release: 1%{?dist} +Summary: Docker CLI plugin for extended build capabilities with BuildKit + +License: Apache-2.0 +URL: https://github.com/docker/buildx +Source0: %{url}/archive/refs/tags/v%{version}.tar.gz + +BuildRequires: go-rpm-macros +BuildRequires: git-core +Requires: docker +Provides: docker-buildx = %{version}-%{release} + + + +%description + + +%prep +%autosetup -n buildx-%{version} + + +%build +go build -v -o docker-buildx ./cmd/buildx + + +%install +install -D -m 0755 docker-buildx %{buildroot}%{_libexecdir}/docker/cli-plugins/docker-buildx + + +%files +%license LICENSE +%doc docs +%{_libexecdir}/docker/cli-plugins/docker-buildx + + +%changelog +* Wed Oct 05 2022 Cappy Ishihara +- Initial Release diff --git a/anda/moby-extras/moby-compose/anda.hcl b/anda/moby-extras/moby-compose/anda.hcl new file mode 100644 index 0000000000..563a19d717 --- /dev/null +++ b/anda/moby-extras/moby-compose/anda.hcl @@ -0,0 +1,6 @@ +project "pkg" { + rpm { + spec = "moby-compose.spec" + sources = "." + } +} \ No newline at end of file diff --git a/anda/moby-extras/moby-compose/moby-compose.spec b/anda/moby-extras/moby-compose/moby-compose.spec new file mode 100644 index 0000000000..8658883ca1 --- /dev/null +++ b/anda/moby-extras/moby-compose/moby-compose.spec @@ -0,0 +1,43 @@ +%define debug_package %{nil} + +Name: moby-compose +Version: 2.11.2 +Release: 1%{?dist} +Summary: Define and run multi-container applications with Docker + +License: Apache-2.0 +URL: https://github.com/docker/compose/ +Source0: %{url}archive/refs/tags/v%{version}.tar.gz +# Source1: https://github.com/docker/buildx/releases/download/v0.9.1/buildx-v0.9.1.linux-amd64 + +BuildRequires: go-rpm-macros +BuildRequires: git-core +BuildRequires: docker +Requires: docker +Provides: docker-compose = %{version}-%{release} +Provides: docker-compose-cli + +%description + + +%prep +%autosetup -n compose-%{version} + + +%build +%make_build + + +%install +mkdir -p %{buildroot}%{_libexecdir}/docker/cli-plugins +install -m 0755 bin/build/docker-compose %{buildroot}%{_libexecdir}/docker/cli-plugins/docker-compose + +%files +%license LICENSE +%doc docs + +%{_libexecdir}/docker/cli-plugins/docker-compose + +%changelog +* Tue Oct 04 2022 Cappy Ishihara +- Initial Release