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

First version of dind repo #2

Merged
merged 4 commits into from
Mar 25, 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
3 changes: 3 additions & 0 deletions .arg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DOCKERHUB_USER=earthly
IMAGE_NAME=dind
EARTHLY_REPO_VERSION=ido-dind-preparations
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will change to a commit hash.
Renovate is configured so that the commit hash will get updated every week (the intention is that this repo will use the most recent tests and dind installation script in earthly/earthly)

2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# PRs require approval from the earthly core team
* @earthly/core
102 changes: 102 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
$schema: "https://docs.renovatebot.com/renovate-schema.json",
extends: [
"config:recommended"
],
configMigration: true,
prHourlyLimit: 1,
schedule: [ // utc timezone
'after 6am on monday',
],
enabledManagers: [
'dockerfile',
'custom.regex',
'github-actions',
],
dockerfile: {
fileMatch: [
'Earthfile',
],
},
customManagers: [
{
// Earthly Version in GH Actions
customType: 'regex',
fileMatch: [
'.*?\\.yml',
],
matchStrings: [
'- uses: earthly/actions/setup-earthly@.*?[\\s\\n]+.*?[\\s\\n]+with:[\\s\\n]*version: (?<currentValue>.*?)[\\s\\n/]+',
],
depNameTemplate: 'earthly/earthly',
datasourceTemplate: 'github-releases',
},
{
// ARG/LET in Earthfile that have a Renovate comment
customType: 'regex',
fileMatch: [
'Earthfile',
],
matchStrings: [
'\\s*#\\s*renovate:\\s*datasource=(?<datasource>.*?)\\s+depName=(?<depName>.*?)[\\s\\n]+(versioning=(?<versioning>.*?)\\s+)?(ARG|LET)\\s+.*?(_VERSION|_VER|version)=(?<currentValue>.*?)($|\\s|\\n)',
],
},
{
// Updating the Repology alpine version
customType: 'regex',
fileMatch: [
'Earthfile',
],
matchStrings: [
'# renovate: datasource=repology depName=alpine_(?<currentValue>\\d+_\\d+)',
],
currentValueTemplate: "{{{ replace '_' '.' currentValue }}}",
datasourceTemplate: 'docker',
depNameTemplate: 'alpine',
versioningTemplate: 'regex:^(?<major>\\d+)[._](?<minor>\\d+)$',
autoReplaceStringTemplate: '# renovate: datasource=repology depName=alpine_{{{newMajor}}}_{{{newMinor}}}',
},
{
// Updating the commit hash of earthly/earthly
customType: 'regex',
fileMatch: ['^\\.arg$'],
matchStrings: [
'EARTHLY_REPO_VERSION=(?<currentDigest>.*?)($|\\s|\\n)',
],
currentValueTemplate: 'main',
depNameTemplate: 'earthly/earthly',
packageNameTemplate: 'https://github.com/earthly/earthly',
datasourceTemplate: 'git-refs',
},
],
labels: [
'renovate',
],
packageRules: [
// set the group name for alpine dind dependencies
{
groupName: "{{{ replace 'os\\/(.*?)$' '$1' packageFileDir}}}-dind-image",
matchPackagePatterns: [
'alpine',
'alpine.*?/docker',
'docker/docker',
],
matchManagers: [
'custom.regex',
],
matchDatasources: [
'docker',
'repology',
'github-releases',
],
matchFileNames: [
'os/**/Earthfile',
],
},
{
// let all package updates auto merge
matchPackagePatterns: [ '*' ],
automerge: true,
},
],
}
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
# TODO: enable when this bug is resolved: https://github.com/earthly/earthly/issues/3930
# push:
# branches: [ "main" ]
pull_request:
branches: [ "main" ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
name: test
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
EARTHLY_CONVERSION_PARALLELISM: "5"
EARTHLY_TOKEN: "${{ secrets.EARTHLY_TOKEN }}"
EARTHLY_INSTALL_ID: "earthly-dind-githubactions"
steps:
- uses: earthly/actions/setup-earthly@v1
with:
version: v0.8.5
- uses: actions/checkout@v4
- name: Docker login (non fork only)
run: |-
docker login --username "${{ secrets.DOCKERHUB_USERNAME }}" --password "${{ secrets.DOCKERHUB_TOKEN }}"
docker login registry-1.docker.io.mirror.corp.earthly.dev --username "${{ secrets.DOCKERHUB_MIRROR_USERNAME }}" --password "${{ secrets.DOCKERHUB_MIRROR_PASSWORD }}"
if: github.event.pull_request.head.repo.full_name == github.repository
- name: Configure Earthly to use mirror (non fork only)
run: |-
earthly config global.buildkit_additional_config "'[registry.\"docker.io\"]
mirrors = [\"registry-1.docker.io.mirror.corp.earthly.dev\"]'"
if: github.event.pull_request.head.repo.full_name == github.repository
- name: Run tests
run: earthly --ci -P --push --org earthly-technologies --satellite dind +test
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
pull_request_target:
types: [ closed ]

jobs:
release:
name: release after merging ${{ github.head_ref }}
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'renovate/') && endsWith(github.head_ref, '-dind-image')
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
EARTHLY_CONVERSION_PARALLELISM: "5"
EARTHLY_TOKEN: "${{ secrets.EARTHLY_TOKEN }}"
EARTHLY_INSTALL_ID: "earthly-dind-githubactions"
steps:
- uses: earthly/actions/setup-earthly@v1
with:
version: v0.8.5
- uses: actions/checkout@v4
- name: Docker login (non fork only)
run: |-
docker login --username "${{ secrets.DOCKERHUB_USERNAME }}" --password "${{ secrets.DOCKERHUB_TOKEN }}"
docker login registry-1.docker.io.mirror.corp.earthly.dev --username "${{ secrets.DOCKERHUB_MIRROR_USERNAME }}" --password "${{ secrets.DOCKERHUB_MIRROR_PASSWORD }}"
if: github.event.pull_request.head.repo.full_name == github.repository
- name: Configure Earthly to use mirror (non fork only)
run: |-
earthly config global.buildkit_additional_config "'[registry.\"docker.io\"]
mirrors = [\"registry-1.docker.io.mirror.corp.earthly.dev\"]'"
if: github.event.pull_request.head.repo.full_name == github.repository
- name: Build & Push image
run: earthly --ci -P --push --org earthly-technologies --satellite dind +release --RENOVATE_BRANCH=${{github.head_ref}}
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing

## Code of Conduct

Please refer to the [CNCF Community Code of Conduct v1.0](https://github.com/cncf/foundation/blob/main/code-of-conduct.md)

## CLA

### Individual

All contributions must indicate agreement to the [Earthly Contributor License Agreement](https://gist.github.com/vladaionescu/ed990fa149a38a53ac74b64155bc6766) by logging into GitHub via the CLA assistant and signing the provided CLA. The CLA assistant will automatically notify the PRs that require CLA signing.

### Entity

If you are an entity, please use the [Earthly Contributor License Agreement form](https://earthly.dev/cla-form) in addition to requiring your individual contributors to sign all contributions.
18 changes: 18 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
VERSION --wildcard-builds 0.8

PROJECT earthly-technologies/core

# test runs tests for all defined dind images in this repo
test:
BUILD --pass-args ./os/*+test-build

# release expects to get a renovate branch in the form of renovate/<os>-dind-image, extracts the os and then kicks off its +release target
# this is meant to be run by a github workflow
release:
FROM alpine
# RENOVATE_BRANCH is the renovate branch that is expected to get merged and trigger this target
ARG --required RENOVATE_BRANCH
LET os=${RENOVATE_BRANCH#renovate/}
# using a LET/SET in the target path does not work, use an ARG instead until it's fixed
ARG OS=${os%-dind-image}
BUILD --pass-args ./os/$OS+release
Loading
Loading