forked from earthly/earthly
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (75 loc) · 3.32 KB
/
reusable-bootstrap-integrations.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Bootstrap Integrations
on:
workflow_call:
inputs:
BUILT_EARTHLY_PATH:
required: true
type: string
BUILD_EARTHLY_TARGET:
required: true
type: string
BINARY:
required: true
type: string
SUDO:
type: string
required: false
RUNS_ON:
required: true
type: string
USE_SATELLITE:
required: false
type: boolean
default: false
SATELLITE_NAME:
required: false
type: string
jobs:
secret-integration:
env:
FORCE_COLOR: 1
EARTHLY_TOKEN: "${{ secrets.EARTHLY_TOKEN }}"
EARTHLY_INSTALL_ID: "earthly-githubactions"
DOCKERHUB_MIRROR_USERNAME: "${{ secrets.DOCKERHUB_MIRROR_USERNAME }}"
DOCKERHUB_MIRROR_PASSWORD: "${{ secrets.DOCKERHUB_MIRROR_PASSWORD }}"
# Used in our github action as the token - TODO: look to change it into an input
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ${{inputs.RUNS_ON}}
steps:
- uses: earthly/actions-setup@main
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: remove docker
run: ${{inputs.SUDO}} apt-get purge docker-engine docker docker.io docker-ce docker-ce-cli ; ${{inputs.SUDO}} rm -rf /usr/bin/docker
if: inputs.binary == 'podman'
- name: Install Podman (with apt-get)
run: ${{inputs.SUDO}} apt-get update && ${{inputs.SUDO}} apt-get install -y podman
if: inputs.binary == 'podman'
- name: Podman debug info
run: podman version && podman info && podman info --debug
if: inputs.binary == 'podman'
- name: Configure Satellites (Earthly Only)
run: earthly sat ls && earthly satellite select ${{inputs.SATELLITE_NAME}}
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && inputs.USE_SATELLITE
- name: Docker mirror login via ${{inputs.BINARY}} (Earthly Only)
run: ${{inputs.SUDO}} ${{inputs.BINARY}} login registry-1.docker.io.mirror.corp.earthly.dev --username "${{ secrets.DOCKERHUB_MIRROR_USERNAME }}" --password "${{ secrets.DOCKERHUB_MIRROR_PASSWORD }}"
- name: Configure Earthly to use mirror (Earthly Only)
run: |-
earthly config global.buildkit_additional_config "'[registry.\"docker.io\"]
mirrors = [\"registry-1.docker.io.mirror.corp.earthly.dev\"]'"
- name: Link Earthly dir to Earthly dev dir
run: mkdir -p ~/.earthly && ln -s ~/.earthly ~/.earthly-dev
- name: Build latest earthly using released earthly
run: ${{inputs.SUDO}} $(which earthly) -P --use-inline-cache ${{inputs.BUILD_EARTHLY_TARGET}}
- name: Set EARTHLY_VERSION_FLAG_OVERRIDES env
run: |-
set -euo pipefail
EARTHLY_VERSION_FLAG_OVERRIDES="$(tr -d '\n' < .earthly_version_flag_overrides)"
echo "EARTHLY_VERSION_FLAG_OVERRIDES=$EARTHLY_VERSION_FLAG_OVERRIDES" >> "$GITHUB_ENV"
- name: Run bootstrap-integration
run: frontend=${{inputs.BINARY}} ./tests/bootstrap/test-bootstrap.sh
- name: Buildkit logs (runs on failure)
run: ${{inputs.SUDO}} ${{inputs.BINARY}} logs earthly-buildkitd
if: ${{ failure() }}