Skip to content
Draft
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
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# PRs require approval from the earthly core team
* @earthly/core
# PRs require approval from the EarthBuild core team
* @EarthBuild/fork-admins
24 changes: 24 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: [
'config:best-practices',
'security:openssf-scorecard',
':semanticCommits',
':pinVersions',
],
configMigration: true,
dockerfile: {
managerFilePatterns: ['/Earthfile/'],
},
customManagers: [
{
customType: 'regex',
description: 'Update _version ARGs and ENVs in Earthfile',
managerFilePatterns: ['/^Earthfile$/'],
matchStrings: [
'#\\s*renovate:\\s*datasource=(?<datasource>[a-z-]+?)(?:\\s+depName=(?<depName>.+?))?\\s+packageName=(?<packageName>.+?)(?:\\s+versioning=(?<versioning>[a-z-]+?))?\\s+(?:ENV|ARG)\\s+.+?(_VERSION|_VER|_version)=(?<currentValue>.+?)\\s',
],
},
],
labels: ['renovate'],
}
71 changes: 42 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,67 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
name: +test
runs-on: [earthly-satellite#gha-lib] # https://docs.earthly.dev/earthly-cloud/satellites/gha-runners
runs-on: ubuntu-24.04
env:
FORCE_COLOR: 1
EARTHLY_CONVERSION_PARALLELISM: "5"
EARTHLY_TOKEN: "${{ secrets.EARTHLY_TOKEN }}"
EARTHLY_INSTALL_ID: "earthly-lib-githubactions"
steps:
- uses: actions/checkout@v2
- name: Docker mirror login (non fork only)
run: docker login registry-1.docker.io.mirror.corp.earthly.dev --username "${{ secrets.DOCKERHUB_MIRROR_USERNAME }}" --password "${{ secrets.DOCKERHUB_MIRROR_PASSWORD }}"
if: github.event_name == 'push' || 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\"]'"
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
- uses: docker/login-action@v3
# if fork no secret access, so skip and take chances on rate limiting.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: earthly/actions-setup@bda7cee4972033c6d6b77d77165e787f389f8752
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: |-
earthly config git "{github.com: {auth: ssh, user: git}}" && \
eval $(ssh-agent) && \
earthly secrets --org earthly-technologies --project core get littleredcorvette-id_rsa | ssh-add - && \
earthly --ci -P +test
run: |
earthly config git "{github.com: {auth: ssh, user: git}}"
eval $(ssh-agent)
mkdir -p ~/.ssh
chmod 700 ~/.ssh
printf '%s\n' "${{ secrets.EARTHBUILDCI_GITHUB_USER_SSH_PRIVATE_KEY }}" | tr -d '\r' > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-add ~/.ssh/id_ed25519
earthly --ci -P --secret-file earthbuildci_id_ed25519=~/.ssh/id_ed25519 +test

test-native-arm:
name: +test-native-arm
runs-on: [earthly-satellite#gha-arm-lib] # https://docs.earthly.dev/earthly-cloud/satellites/gha-runners
runs-on: ubuntu-24.04-arm
env:
FORCE_COLOR: 1
EARTHLY_CONVERSION_PARALLELISM: "5"
EARTHLY_TOKEN: "${{ secrets.EARTHLY_TOKEN }}"
EARTHLY_INSTALL_ID: "earthly-lib-githubactions"
steps:
- uses: actions/checkout@v2
- name: Docker mirror login (non fork only)
run: docker login registry-1.docker.io.mirror.corp.earthly.dev --username "${{ secrets.DOCKERHUB_MIRROR_USERNAME }}" --password "${{ secrets.DOCKERHUB_MIRROR_PASSWORD }}"
if: github.event_name == 'push' || 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\"]'"
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
- uses: docker/login-action@v3
# if fork no secret access, so skip and take chances on rate limiting.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: earthly/actions-setup@bda7cee4972033c6d6b77d77165e787f389f8752
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: |-
earthly config git "{github.com: {auth: ssh, user: git}}" && \
eval $(ssh-agent) && \
earthly secrets --org earthly-technologies --project core get littleredcorvette-id_rsa | ssh-add - && \
earthly --ci -P ./utils/dind+test
run: |
earthly config git "{github.com: {auth: ssh, user: git}}"
eval $(ssh-agent)
mkdir -p ~/.ssh
chmod 700 ~/.ssh
printf '%s\n' "${{ secrets.EARTHBUILDCI_GITHUB_USER_SSH_PRIVATE_KEY }}" | tr -d '\r' > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-add ~/.ssh/id_ed25519
ssh-keyscan -t rsa,ecdsa,ed25519 -H github.com >> ~/.ssh/known_hosts
ssh-keyscan -p 443 -t rsa,ecdsa,ed25519 -H ssh.github.com >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
earthly --ci -P --secret-file earthbuildci_id_ed25519=~/.ssh/id_ed25519 +test
10 changes: 0 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,3 @@
## 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.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# lib

Earthly's official collection of [functions](https://docs.earthly.dev/docs/guides/functions).
Earthly's official collection of [functions](https://docs.earthbuild.dev/docs/guides/functions).

## Contributing

* Please report bugs as [GitHub issues](https://github.com/earthly/lib/issues).
* Join us on [Slack](https://earthly.dev/slack)!
* Please report bugs as [GitHub issues](https://github.com/EarthBuild/lib/issues).
* Questions via GitHub issues are welcome!
* PRs welcome! But please give a heads-up in a GitHub issue before starting work. If there is no GitHub issue for what you want to do, please create one.
* Check the [contributing page](./CONTRIBUTING.md) for more details.

## Licensing

Earthly is licensed under the Mozilla Public License Version 2.0. See [LICENSE](./LICENSE).
Earthly is licensed under the Mozilla Public License Version 2.0. See [LICENSE](./LICENSE).
20 changes: 0 additions & 20 deletions billing/README.md

This file was deleted.

18 changes: 9 additions & 9 deletions gradle/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ VERSION --global-cache 0.7


# GRADLE_GET_MOUNT_CACHE sets the following entries in the calling environment:
# EARTHLY_GRADLE_USER_HOME_CACHE: Code of the mount cache for the gradle home.
# EARTHLY_GRADLE_PROJECT_CACHE: Code of the mount cache for the .gradle folder.
# EARTH_GRADLE_USER_HOME_CACHE: Code of the mount cache for the gradle home.
# EARTH_GRADLE_PROJECT_CACHE: Code of the mount cache for the .gradle folder.
# Example:
# DO gradle+GRADLE_GET_MOUNT_CACHE
# RUN --mount=$EARTHLY_GRADLE_USER_HOME_CACHE --mount=$EARTHLY_GRADLE_PROJECT_CACHE gradle --no-daemon build
# RUN --mount=$EARTH_GRADLE_USER_HOME_CACHE --mount=$EARTH_GRADLE_PROJECT_CACHE gradle --no-daemon build
# Arguments:
# - cache_prefix: To be used in both caches. By default: ${EARTHLY_TARGET_PROJECT_NO_TAG}#${OS_RELEASE}#earthly-gradle-cache
# - cache_prefix: To be used in both caches. By default: ${EARTH_TARGET_PROJECT_NO_TAG}#${OS_RELEASE}#earth-gradle-cache
GRADLE_GET_MOUNT_CACHE:
COMMAND
ARG EARTHLY_TARGET_PROJECT_NO_TAG
ARG cache_prefix = "${EARTHLY_TARGET_PROJECT_NO_TAG}#earthly-gradle-cache"
ARG EARTH_TARGET_PROJECT_NO_TAG
ARG cache_prefix = "${EARTH_TARGET_PROJECT_NO_TAG}#earth-gradle-cache"
IF [ "$GRADLE_USER_HOME" = "" ]
ENV GRADLE_USER_HOME="$HOME/.gradle"
END
ENV EARTHLY_GRADLE_CACHE_PREFIX=$cache_prefix
ENV EARTHLY_GRADLE_USER_HOME_CACHE="type=cache,mode=0777,id=$cache_prefix,sharing=shared,target=$GRADLE_USER_HOME"
ENV EARTHLY_GRADLE_PROJECT_CACHE="type=cache,mode=0777,id=${cache_prefix}#project,sharing=shared,target=.gradle"
ENV EARTH_GRADLE_CACHE_PREFIX=$cache_prefix
ENV EARTH_GRADLE_USER_HOME_CACHE="type=cache,mode=0777,id=$cache_prefix,sharing=shared,target=$GRADLE_USER_HOME"
ENV EARTH_GRADLE_PROJECT_CACHE="type=cache,mode=0777,id=${cache_prefix}#project,sharing=shared,target=.gradle"
16 changes: 8 additions & 8 deletions gradle/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# lib/gradle

Earthly's official collection of Gradle [functions](https://docs.earthly.dev/docs/guides/functions).
EarthBuild's official collection of Gradle [functions](https://docs.earthbuild.dev/docs/guides/functions).

First, import the library up in your Earthfile:
```earthfile
VERSION --global-cache 0.7
IMPORT github.com/earthly/lib/gradle:<version/commit> AS gradle
IMPORT github.com/EarthBuild/lib/gradle:<version/commit> AS gradle
```
> :warning: Due to [this issue](https://github.com/earthly/earthly/issues/3490), make sure to enable `--global-cache` in the calling Earthfile, as shown above.

## +GRADLE_GET_MOUNT_CACHE

This function sets the following entries in the calling environment, so they can be used later to parametrize two global mount caches in `RUN` commands:
- `$EARTHLY_GRADLE_USER_HOME_CACHE`: Code of the mount cache for the [gradle user home](https://docs.gradle.org/current/userguide/directory_layout.html#dir:gradle_user_home) directory.
- `$EARTHLY_GRADLE_PROJECT_CACHE`: Code of the mount cache for the [gradle project root](https://docs.gradle.org/current/userguide/directory_layout.html#dir:project_root) directory.
- `$EARTH_GRADLE_USER_HOME_CACHE`: Code of the mount cache for the [gradle user home](https://docs.gradle.org/current/userguide/directory_layout.html#dir:gradle_user_home) directory.
- `$EARTH_GRADLE_PROJECT_CACHE`: Code of the mount cache for the [gradle project root](https://docs.gradle.org/current/userguide/directory_layout.html#dir:project_root) directory.

### Arguments
- `cache_prefix`: To be used in both caches. By default: `${EARTHLY_TARGET_PROJECT_NO_TAG}#${OS_RELEASE}#earthly-gradle-cache`
- `cache_prefix`: To be used in both caches. By default: `${EARTH_TARGET_PROJECT_NO_TAG}#${OS_RELEASE}#earth-gradle-cache`

### Example
```earthly
```earthfile
DO gradle+GRADLE_GET_MOUNT_CACHE
RUN --mount=$EARTHLY_GRADLE_USER_HOME_CACHE --mount=$EARTHLY_GRADLE_PROJECT_CACHE gradle --no-daemon build
RUN --mount=$EARTH_GRADLE_USER_HOME_CACHE --mount=$EARTH_GRADLE_PROJECT_CACHE gradle --no-daemon build
```

### Scoping
Expand All @@ -30,4 +30,4 @@ If `cache_prefix` is not set, the two global caches have an Earthfile-scope, tha
Otherwise, all Earthfiles using the same `cache_prefix` will share the cache mounts.

## Example
See [earthly-intellij-plugin](https://github.com/earthly/earthly-intellij-plugin/blob/main/Earthfile) for a complete example.
See [earth-intellij-plugin](https://github.com/EarthBuild/earthly-intellij-plugin/blob/main/Earthfile) for a complete example.
Loading
Loading