-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from NethServer/buildah-migration
Migration from Travis CI/Docker to Github Actions/Buildah NethServer/dev#6700
- Loading branch information
Showing
22 changed files
with
153 additions
and
200 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,55 @@ | ||
name: Build and Push Container | ||
on: | ||
push: | ||
schedule: | ||
- cron: "0 4 * * 1" | ||
env: | ||
registry: docker.io | ||
image: nethserver/makerpms | ||
platforms: "linux/amd64" | ||
registry_user: ${{ secrets.registry_user }} | ||
registry_password: ${{ secrets.registry_password }} | ||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
target: | ||
- makerpms | ||
- buildsys | ||
- devtoolset | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Outputting correct prefix/suffix for each target | ||
id: prefix | ||
run: | | ||
if [[ "${{ matrix.target }}" != "makerpms" ]]; then | ||
echo "::set-output name=prefix::-${{ matrix.target }}" | ||
fi | ||
- uses: docker/metadata-action@v4 | ||
id: meta | ||
with: | ||
images: | | ||
${{ env.registry }}/${{ env.image }} | ||
tags: | | ||
type=ref,event=branch,suffix=-7${{ steps.prefix.outputs.prefix }},enable=${{ github.ref != format('refs/heads/{0}', 'master') }} | ||
type=raw,value=7,prefix=${{ steps.prefix.outputs.prefix }},enable=${{ github.ref == format('refs/heads/{0}', 'master') }} | ||
flavor: | | ||
latest=false | ||
- uses: redhat-actions/buildah-build@v2 | ||
with: | ||
containerfiles: | | ||
container/Containerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
layers: true | ||
context: container | ||
platforms: ${{ env.platforms }} | ||
extra-args: | ||
--target ${{ matrix.target }} | ||
- uses: redhat-actions/push-to-registry@v2 | ||
if: ${{ env.registry_user != '' && env.registry_password != '' }} | ||
with: | ||
tags: ${{ steps.meta.outputs.tags }} | ||
username: ${{ env.registry_user }} | ||
password: ${{ env.registry_password }} |
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
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,34 @@ | ||
#!/bin/env bash | ||
|
||
function build_image() | ||
{ | ||
echo "Building $1 image..." | ||
if [[ "$1" != "makerpms" ]]; then | ||
tag="$1" | ||
fi | ||
tag+=7 | ||
buildah build \ | ||
--layers \ | ||
--force-rm \ | ||
--tag "$image:$tag" \ | ||
--file container/Containerfile \ | ||
--target "$1" \ | ||
container | ||
} | ||
|
||
image=${IMAGE_REPO:-nethserver/makerpms} | ||
if ! command -v buildah &> /dev/null; then | ||
echo "buildah could not be found, is needed for the script to run." | ||
exit 1 | ||
fi | ||
|
||
declare -a targets=() | ||
if [[ $# -gt 0 ]]; then | ||
targets+=("$@") | ||
else | ||
targets+=("makerpms" "buildsys" "devtoolset") | ||
fi | ||
|
||
for var in "${targets[@]}"; do | ||
build_image "$var" | ||
done |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
UserKnownHostsFile=/dev/null | ||
StrictHostKeyChecking=no |
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 @@ | ||
# File should be empty. |
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,40 @@ | ||
FROM centos:7 as makerpms | ||
RUN yum -y install \ | ||
http://packages.nethserver.org/nethserver/nethserver-release-7.rpm \ | ||
centos-release-scl \ | ||
epel-release \ | ||
expect \ | ||
git \ | ||
nethserver-devtools \ | ||
openssl \ | ||
perl \ | ||
rpmdevtools \ | ||
sed \ | ||
sudo \ | ||
yum-utils \ | ||
&& yum clean all \ | ||
&& rm -rf /var/cache/yum/* | ||
|
||
COPY bin /usr/local/bin | ||
COPY sudoers.d /etc/sudoers.d | ||
RUN chmod 755 /usr/local/bin/{make*,upload*} \ | ||
&& chmod 440 /etc/sudoers.d/10_makerpms \ | ||
&& useradd -m -d /srv/makerpms -r makerpms | ||
|
||
USER makerpms | ||
COPY --chown=makerpms:makerpms .ssh /srv/makerpms/.ssh | ||
RUN chmod 700 /srv/makerpms/.ssh \ | ||
&& chmod 600 \ | ||
/srv/makerpms/.ssh/config \ | ||
/srv/makerpms/.ssh/id_rsa \ | ||
&& rpmdev-setuptree -d \ | ||
&& echo '%url_prefix http://github.com/NethServer' >> /srv/makerpms/.rpmmacros \ | ||
&& mkdir /srv/makerpms/src | ||
|
||
WORKDIR /srv/makerpms/src | ||
|
||
FROM makerpms as buildsys | ||
RUN sudo yum -y install @buildsys-build | ||
|
||
FROM buildsys as devtoolset | ||
RUN sudo yum -y install --enablerepo=ce-sclo-rh devtoolset-9-\* |
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
File renamed without changes.
File renamed without changes.
Oops, something went wrong.