Skip to content

Commit 70959b8

Browse files
committed
fix: don't use branch name in ci
GitHub is keeps checking out the SHA directly rather than the branch. As a result, we simply don't have access to the branch name period. Signed-off-by: Daniel Noland <[email protected]>
1 parent 3ae7775 commit 70959b8

File tree

3 files changed

+16
-41
lines changed

3 files changed

+16
-41
lines changed

Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ RUN chown -R frr:frr /var/run/frr
1010
#RUN ln -s / $(< /the-path-to-frr) && rm /the-path-to-frr
1111
FROM scratch AS frr-release
1212
COPY --from=frr-base / /
13+
CMD ["/libexec/frr/docker-start"]
1314
FROM scratch AS frr-debug
1415
COPY --from=frr-base / /
15-
#RUN export TO=$(dirname $(readlink /lib/frr/modules/zebra_fpm.so)) \
16-
# && cp /lib/frr/modules/zebra_hh_dplane.so $TO
1716
CMD ["/libexec/frr/docker-start"]
1817
FROM ${IMAGE} AS doc-env
19-
FROM ${IMAGE} AS libc-env-release
20-
FROM ${IMAGE} AS libc-env-debug
18+
FROM ${IMAGE} AS libc-env
2119
FROM ${IMAGE} AS mstflint-release
2220
FROM ${IMAGE} AS mstflint-debug
2321
FROM ${IMAGE} AS compile-env

default.nix

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ rec {
632632

633633
container-profile = profile: {
634634
frr = toolchainPkgs.dockerTools.buildLayeredImage {
635-
name = "${contianer-repo}/frr";
635+
name = "${contianer-repo}/frr-${profile}";
636636
tag = "${image-tag}";
637637
contents = toolchainPkgs.buildEnv {
638638
name = "frr-env-${profile}";
@@ -660,7 +660,7 @@ rec {
660660
};
661661

662662
mstflint = toolchainPkgs.dockerTools.buildLayeredImage {
663-
name = "${contianer-repo}/mstflint";
663+
name = "${contianer-repo}/mstflint-${profile}";
664664
tag = "${image-tag}";
665665
contents = [
666666
pkgs.${profile}.gnu64.mstflint
@@ -682,10 +682,9 @@ rec {
682682
{
683683
frr-release = release.frr;
684684
frr-debug = debug.frr;
685-
mstflint-release = release.mstflint;
686-
mstflint-debug = debug.mstflint;
687-
libc-env-release = release.libc-env;
688-
libc-env-debug = debug.libc-env;
685+
mstflint-debug = release.mstflint;
686+
mstflint-release = debug.mstflint;
687+
libc-env = release.libc-env;
689688
compile-env = toolchainPkgs.dockerTools.buildLayeredImage {
690689
name = "${contianer-repo}/compile-env";
691690
tag = "${image-tag}";

justfile

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,10 @@ _commit := `git rev-parse HEAD`
5959

6060
# The git branch we are currnetly on
6161

62-
[private]
63-
_branch := `git rev-parse --abbrev-ref HEAD | sed 's/[^a-zA-Z0-9]/-/g'`
64-
6562
# The slug is the branch name (sanitized) with a marker if the tree is dirty
6663

6764
[private]
68-
_slug := (if _clean == "clean" { "" } else { "dirty." }) + _branch
65+
_slug := (if _clean == "clean" { "" } else { "dirty." }) + _commit
6966

7067
# The name of the doc-env container
7168

@@ -77,11 +74,11 @@ _doc_env_container_name := container_repo + "/doc-env"
7774
[private]
7875
_compile_env_container_name := container_repo + "/compile-env"
7976
[private]
80-
_frr_container_name := container_repo + "/frr"
77+
_frr_container_name := container_repo + "/frr-" + profile
8178
[private]
8279
_libc_container_name := container_repo + "/libc-env"
8380
[private]
84-
_mstflint_container_name := container_repo + "/mstflint"
81+
_mstflint_container_name := container_repo + "/mstflint-" + profile
8582

8683
# This is a unique identifier for the build.
8784
# We temporarily tag our containers with this id so that we can be certain that we are
@@ -122,11 +119,9 @@ _nix_build attribute:
122119
-f default.nix \
123120
"{{ attribute }}" \
124121
--out-link "/tmp/dpdk-sys/builds/{{ attribute }}" \
125-
--argstr onlyRunDeps false \
126122
--argstr container-repo "{{ container_repo }}" \
127123
--argstr image-tag "{{ _build-id }}" \
128124
--argstr rust-channel "{{ rust }}" \
129-
--argstr profile "{{ profile }}" \
130125
"-j{{ max_nix_builds }}" \
131126
`if [ "{{ cores }}" != "all" ]; then echo --cores "{{ cores }}"; fi`
132127

@@ -150,7 +145,6 @@ _build-container target container-name: (_nix_build ("container." + target))
150145
docker load --input /tmp/dpdk-sys/builds/container.{{ target }}
151146
docker build \
152147
--label "git.commit={{ _commit }}" \
153-
--label "git.branch={{ _branch }}" \
154148
--label "git.tree-state={{ _clean }}" \
155149
--label "build.date=${build_date}" \
156150
--label "build.timestamp={{ _build_time }}" \
@@ -183,18 +177,7 @@ _build-container target container-name: (_nix_build ("container." + target))
183177
.
184178
docker tag \
185179
"{{ container-name }}:post-{{ _build-id }}" \
186-
"{{ container-name }}:{{ _slug }}.{{ profile }}"
187-
docker tag \
188-
"{{ container-name }}:post-{{ _build-id }}" \
189-
"{{ container-name }}:{{ _commit }}.{{ profile }}"
190-
if [ "{{ profile }}" = "release" ]; then
191-
docker tag \
192-
"{{ container-name }}:post-{{ _build-id }}" \
193-
"{{ container-name }}:{{ _slug }}"
194-
docker tag \
195-
"{{ container-name }}:post-{{ _build-id }}" \
196-
"{{ container-name }}:{{ _commit }}"
197-
fi
180+
"{{ container-name }}:{{ _slug }}"
198181
docker rmi "{{ container-name }}:{{ _build-id }}"
199182
docker rmi "{{ container-name }}:post-{{ _build-id }}"
200183

@@ -208,10 +191,10 @@ build-compile-env-container: build-sysroot (_build-container "compile-env" _comp
208191
build-frr-container: (_build-container "frr-" + profile _frr_container_name)
209192

210193
# Build and tag the libc container
211-
build-libc-container: (_build-container "libc-env-" + profile _libc_container_name)
194+
build-libc-container: (_build-container "libc-env" _libc_container_name)
212195

213196
# Build and tag the libc container
214-
build-mstflint-container: (_build-container "mstflint-" + profile _mstflint_container_name)
197+
build-mstflint-container: (_build-container "mstflint" _mstflint_container_name)
215198

216199
# Build the sysroot, and compile-env containers
217200
build: build-sysroot build-libc-container build-frr-container build-compile-env-container build-doc-env-container
@@ -221,16 +204,11 @@ build: build-sysroot build-libc-container build-frr-container build-compile-env-
221204
push: build
222205
{{ _just_debug_ }}
223206
docker push "{{ _compile_env_container_name }}:{{ _slug }}"
224-
docker push "{{ _compile_env_container_name }}:{{ _commit }}"
225207
docker push "{{ _doc_env_container_name }}:{{ _slug }}"
226-
docker push "{{ _doc_env_container_name }}:{{ _commit }}"
227-
docker push "{{ _frr_container_name }}:{{ _slug }}.{{ profile }}"
228-
docker push "{{ _frr_container_name }}:{{ _commit }}.{{ profile }}"
229-
docker push "{{ _libc_container_name }}:{{ _slug }}.{{ profile }}"
230-
docker push "{{ _libc_container_name }}:{{ _commit }}.{{ profile }}"
208+
docker push "{{ _frr_container_name }}:{{ _slug }}"
209+
docker push "{{ _libc_container_name }}:{{ _slug }}"
231210
# Temporary comment to reduce build times
232-
# docker push "{{ _mstflint_container_name }}:{{ _slug }}.{{ profile }}"
233-
# docker push "{{ _mstflint_container_name }}:{{ _commit }}.{{ profile }}"
211+
# docker push "{{ _mstflint_container_name }}:{{ _slug }}"
234212

235213
# Delete all the old generations of the nix store and run the garbage collector
236214
[script]

0 commit comments

Comments
 (0)