-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathEarthfile
More file actions
143 lines (111 loc) · 3.75 KB
/
Copy pathEarthfile
File metadata and controls
143 lines (111 loc) · 3.75 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
VERSION 0.8
PROJECT blue-build/cli
IMPORT github.com/earthly/lib/utils/dind AS dind
all:
BUILD +build
BUILD +switch
BUILD +validate
BUILD +template-containerfile
BUILD +template-legacy-containerfile
template-containerfile:
FROM +test-base
RUN --no-cache bluebuild -v generate recipes/recipe.yml | tee Containerfile
SAVE ARTIFACT /test
template-legacy-containerfile:
FROM +legacy-base
RUN --no-cache bluebuild -v template config/recipe.yml | tee Containerfile
SAVE ARTIFACT /test
build:
FROM +test-base
RUN bluebuild -v build recipes/recipe.yml
build-full:
FROM +test-base --MOCK="false"
DO dind+INSTALL
ENV BB_USERNAME=gmpinder
ENV BB_REGISTRY=ghcr.io
ENV BB_REGISTRY_NAMESPACE=blue-build
WITH DOCKER
RUN --secret BB_PASSWORD=github/registry bluebuild build --push -S sigstore -vv recipes/recipe.yml
END
switch:
FROM +test-base
RUN --no-cache bluebuild -v switch --boot-driver rpm-ostree recipes/recipe.yml
RUN --no-cache bluebuild -v switch --boot-driver bootc recipes/recipe.yml
validate:
FROM +test-base
RUN --no-cache bluebuild -v validate recipes/recipe.yml
RUN --no-cache bluebuild -v validate recipes/recipe-gts.yml
RUN --no-cache bluebuild -v validate recipes/recipe-arm64.yml
RUN --no-cache bluebuild -v validate recipes/recipe-invalid.yml && exit 1 || exit 0
RUN --no-cache bluebuild -v validate recipes/recipe-invalid-module.yml && exit 1 || exit 0
RUN --no-cache bluebuild -v validate recipes/recipe-invalid-stage.yml && exit 1 || exit 0
RUN --no-cache bluebuild -v validate recipes/recipe-invalid-from-file.yml && exit 1 || exit 0
init:
FROM +test-base
WORKDIR /tmp
RUN --no-cache bluebuild new test-github \
--image-name test-github \
--org-name test \
--description 'This is a description' \
--registry 'ghcr.io' \
--ci-provider github
RUN --no-cache bluebuild new test-gitlab \
--image-name test-gitlab \
--org-name test \
--description 'This is a description' \
--registry 'registry.gitlab.com' \
--ci-provider gitlab
RUN --no-cache bluebuild new test-none \
--image-name test-none \
--org-name test \
--description 'This is a description' \
--registry 'docker.io' \
--ci-provider none \
--no-git
WORKDIR /tmp/test-init
RUN --no-cache bluebuild init \
--image-name test-init \
--org-name test \
--description 'This is a description' \
--registry 'docker.io' \
--ci-provider none \
--no-git
legacy-base:
FROM ../+blue-build-cli --RELEASE=false
ENV BB_TEST_LOCAL_IMAGE=localhost/cli/test:latest
ENV CLICOLOR_FORCE=1
COPY ./mock-scripts/ /usr/bin/
WORKDIR /test
COPY ./legacy-test-repo /test
DO ../+INSTALL --OUT_DIR="/usr/bin/" --BUILD_TARGET="x86_64-unknown-linux-musl" --TAGGED="true"
DO +GEN_KEYPAIR
ENV USER=root
test-base:
FROM ../+blue-build-cli --RELEASE=false
RUN git config --global user.email "you@example.com" && \
git config --global user.name "Your Name"
ENV BB_TEST_LOCAL_IMAGE=localhost/cli/test:latest
ENV CLICOLOR_FORCE=1
ARG MOCK="true"
IF [ "$MOCK" = "true" ]
COPY ./mock-scripts/ /usr/bin/
END
WORKDIR /test
COPY ./test-repo /test
DO +GEN_KEYPAIR
ENV USER=root
GEN_KEYPAIR:
FUNCTION
# Setup a cosign key pair
ENV COSIGN_PASSWORD=""
ENV COSIGN_YES="true"
RUN cosign generate-key-pair
ENV COSIGN_PRIVATE_KEY=$(cat cosign.key)
RUN rm cosign.key
RUN_TESTS:
FUNCTION
FOR script IN $(ls *.sh)
RUN --no-cache chmod +x $script \
&& echo "Running test $script" \
&& ./$script
END