Skip to content

Docker build run #102

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

Merged
merged 1 commit into from
Jun 11, 2025
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
31 changes: 11 additions & 20 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"automerge": true,
"dockerfile": {
"managerFilePatterns": [
"/(^|/)Earthfile$/",
"/(^|/|\\.)Dockerfile$/",
"/(^|/)Dockerfile[^/]*$/"
]
Expand All @@ -15,7 +14,8 @@
{
"customType": "regex",
"managerFilePatterns": [
"/^Earthfile$/"
"/(^|/|\\.)Dockerfile$/",
"/(^|/)Dockerfile[^/]*$/"
],
"matchStrings": [
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s.+_VERSION=\"(?<currentValue>.*?)\"\\s"
Expand All @@ -24,27 +24,18 @@
{
"customType": "regex",
"managerFilePatterns": [
"/^Earthfile$/"
"/(^|/|\\.)Dockerfile$/",
"/(^|/)Dockerfile[^/]*$/"
],
"matchStringsStrategy": "recursive",
"matchStrings": [
"# renovate: datasource=repology depName=alpine_(?<currentValue>\\d+[._]\\d+)"
"FROM\\s*.*?alpine[.:]?(?<alpineMajor>\\d+)\\.(?<alpineMinor>\\d+)(?:\\n|.)*",
"apk\\s+add\\s+(?:\\n|.)*?[^\\\\]\\n",
"(?<name>[^\\s=~]+)~?=(?<currentValue>[^\\s=]+)"
],
"currentValueTemplate": "{{{ replace '_' '.' currentValue }}}",
"datasourceTemplate": "docker",
"depNameTemplate": "alpine",
"versioningTemplate": "regex:^(?<major>\\d+)[._](?<minor>\\d+)$",
"autoReplaceStringTemplate": "# renovate: datasource=repology depName=alpine_{{{newMajor}}}_{{{newMinor}}}"
},
{
"customType": "regex",
"managerFilePatterns": [
"/^[.]github/workflows//"
],
"matchStrings": [
".*version: (?<currentValue>.*?)\\s"
],
"datasourceTemplate": "github-tags",
"depNameTemplate": "earthly/earthly"
"datasourceTemplate": "repology",
"depNameTemplate": "alpine_{{alpineMajor}}_{{alpineMinor}}/{{name}}",
"versioningTemplate": "loose"
}
]
}
15 changes: 14 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@ jobs:
- name: Checkout code.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Compile.
run: earthly --ci +compile
run: make compile
unit-test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: Download Earthly.
uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 # v1.0.13
with:
version: v0.8.15
- name: Checkout code.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Unit Test.
run: make unit-test

10 changes: 1 addition & 9 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,15 @@ name: Conventional Commits

on: pull_request

env:
# Forcing Earthly to use colours, to make reading output easier.
FORCE_COLOR: 1

jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Download Earthly.
uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 # v1.0.13
with:
version: v0.8.15
- name: Checkout code.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Check Conventional Commits linting.
run: earthly --ci +check-conventional-commits-linting --from_reference "origin/${{ github.base_ref }}"
run: make check-conventional-commits-linting FROM="origin/${{ github.base_ref }}"
10 changes: 1 addition & 9 deletions .github/workflows/git-history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,15 @@ name: Git History

on: pull_request

env:
# Forcing Earthly to use colours, to make reading output easier.
FORCE_COLOR: 1

jobs:
clean:
name: Clean
runs-on: ubuntu-latest
steps:
- name: Download Earthly.
uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 # v1.0.13
with:
version: v0.8.15
- name: Checkout code.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Check clean Git history.
run: earthly --ci +check-clean-git-history --from "origin/${{ github.base_ref }}"
run: make check-clean-git-history FROM="origin/${{ github.base_ref }}"
16 changes: 2 additions & 14 deletions .github/workflows/github-actions-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,20 @@ name: GitHub Actions Workflows

on: pull_request

env:
# Forcing Earthly to use colours, to make reading output easier.
FORCE_COLOR: 1

jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Download Earthly.
uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 # v1.0.13
with:
version: v0.8.15
- name: Checkout code.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Check GitHub Actions workflows linting.
run: earthly +check-github-actions-workflows-linting
run: make check-github-actions-workflows-linting
formatting:
name: Formatting
runs-on: ubuntu-latest
steps:
- name: Download Earthly.
uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 # v1.0.13
with:
version: v0.8.15
- name: Checkout code.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Check formatting.
run: earthly +check-yaml-formatting
run: make check-yaml-formatting
2 changes: 1 addition & 1 deletion .github/workflows/mirroring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
- name: Checkout code.
run: git clone --mirror "https://github.com/${GITHUB_REPOSITORY}.git" "${GITHUB_WORKSPACE}"
- name: Get GitLab repository.
run: echo "REPOSITORY_NAME=$(echo "${GITHUB_REPOSITORY}" | sed "s|^${GITHUB_REPOSITORY_OWNER}/||g")" >> "${GITHUB_ENV}"
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY/${GITHUB_REPOSITORY_OWNER}/}" >> "${GITHUB_ENV}"
- name: Mirroring.
run: git push --mirror "https://oauth2:${{ secrets.GITLAB_PERSONAL_ACCESS_TOKEN }}@gitlab.com/DeveloperC/${REPOSITORY_NAME}"
91 changes: 0 additions & 91 deletions Earthfile

This file was deleted.

59 changes: 31 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
# linux-x86-shellcode-generator
# See LICENSE file for copyright and license details.
.POSIX:
# So new files are owned by the user.
UID := $(shell id -u)
GID := $(shell id -g)

CC=gcc
.PHONY: check-clean-git-history check-conventional-commits-linting check-yaml-formatting fix-yaml-formatting check-github-actions-workflows-linting compile unit-test payload

SOURCE=src/shellcode-generator.c
OBJECT=shellcode-generator
CFLAGS=
check-clean-git-history:
docker build -t check-clean-git-history -f ci/check-clean-git-history.Dockerfile .
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) check-clean-git-history $(FROM)

TEST_SOURCE=tests/shellcode-generator-tests.c
TEST_OBJECT=shellcode-generator-tests
TEST_CFLAGS=-lcunit
check-conventional-commits-linting:
docker build -t check-conventional-commits-linting -f ci/check-conventional-commits-linting.Dockerfile .
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) check-conventional-commits-linting $(FROM)

PAYLOAD_SOURCE=output.c
PAYLOAD_OBJECT=output
PAYLOAD_CFLAGS=-m32 -fno-stack-protector -z execstack
check-yaml-formatting:
docker pull ghcr.io/google/yamlfmt:0.17.0
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) ghcr.io/google/yamlfmt:0.17.0 -verbose -lint -dstar .github/workflows/*

.PHONY: all
all: $(OBJECT)
fix-yaml-formatting:
docker pull ghcr.io/google/yamlfmt:0.17.0
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) ghcr.io/google/yamlfmt:0.17.0 -verbose -dstar .github/workflows/*

$(OBJECT): $(SOURCE)
$(CC) -o $(OBJECT) $(SOURCE) $(CFLAGS)
check-github-actions-workflows-linting:
docker pull rhysd/actionlint:1.7.7
docker run --rm -v $(PWD):/workspace -w /workspace -u $(UID):$(GID) rhysd/actionlint:1.7.7 -verbose -color

.PHONY: clean
clean:
rm -f $(OBJECT)
rm -f $(TEST_OBJECT)
rm -f $(PAYLOAD_OBJECT)
compile:
docker build -t compile -f ci/compile.Dockerfile .
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) compile

.PHONY: test
test: $(TEST_OBJECT)
./$(TEST_OBJECT)
unit-test:
docker build -t unit-test -f ci/unit-test.Dockerfile .
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) unit-test

$(TEST_OBJECT): $(TEST_SOURCE)
$(CC) -o $(TEST_OBJECT) $(TEST_SOURCE) $(TEST_CFLAGS)
PAYLOAD_SOURCE=output.c
PAYLOAD_OBJECT=output
PAYLOAD_CFLAGS=-m32 -fno-stack-protector -z execstack

.PHONY: payload
payload: $(PAYLOAD_OBJECT)
./$(PAYLOAD_OBJECT)

$(PAYLOAD_OBJECT): $(PAYLOAD_SOURCE)
$(CC) -o $(PAYLOAD_OBJECT) $(PAYLOAD_SOURCE) $(PAYLOAD_CFLAGS)



10 changes: 10 additions & 0 deletions ci/check-clean-git-history.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM rust:1.87.0-alpine3.21@sha256:fa7c28576553c431224a85c897c38f3a6443bd831be37061ab3560d9e797dc82

# renovate: datasource=github-releases depName=DeveloperC286/clean_git_history
ENV CLEAN_GIT_HISTORY_VERSION="v1.0.3"
RUN wget -O - "https://github.com/DeveloperC286/clean_git_history/releases/download/${CLEAN_GIT_HISTORY_VERSION}/x86_64-unknown-linux-musl.tar.gz" | tar xz --directory "/usr/bin/"

WORKDIR /workspace

ENTRYPOINT ["clean_git_history"]
CMD ["origin/HEAD"]
11 changes: 0 additions & 11 deletions ci/check-clean-git-history.sh

This file was deleted.

10 changes: 10 additions & 0 deletions ci/check-conventional-commits-linting.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM rust:1.87.0-alpine3.21@sha256:fa7c28576553c431224a85c897c38f3a6443bd831be37061ab3560d9e797dc82

# renovate: datasource=github-releases depName=DeveloperC286/conventional_commits_linter
ENV CONVENTIONAL_COMMITS_LINTER_VERSION="v0.14.3"
RUN wget -O - "https://github.com/DeveloperC286/conventional_commits_linter/releases/download/${CONVENTIONAL_COMMITS_LINTER_VERSION}/x86_64-unknown-linux-musl.gz" | gzip -d >/usr/bin/conventional_commits_linter && chmod 755 /usr/bin/conventional_commits_linter

WORKDIR /workspace

ENTRYPOINT ["conventional_commits_linter", "--allow-angular-type-only", "--from-reference"]
CMD ["origin/HEAD"]
Loading
Loading