Skip to content

Commit

Permalink
fix: capitalize 'as' to follow from-as-casing rule (#687)
Browse files Browse the repository at this point in the history
* fix: capitalize 'as' to follow from-as-casing rule
  • Loading branch information
kurokobo authored Jun 25, 2024
1 parent 6870747 commit b1273ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG BASE_IMAGE=quay.io/centos/centos:stream9

FROM $BASE_IMAGE as builder
FROM $BASE_IMAGE AS builder
# build this library (meaning ansible-builder)
COPY . /tmp/src
COPY ./src/ansible_builder/_target_scripts/* /output/scripts/
Expand Down
8 changes: 4 additions & 4 deletions src/ansible_builder/containerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def prepare(self) -> None:
# 'base' (possibly customized) will be used by future build stages
self.steps.extend([
"# Base build stage",
"FROM $EE_BASE_IMAGE as base",
"FROM $EE_BASE_IMAGE AS base",
"USER root",
"ENV PIP_BREAK_SYSTEM_PACKAGES=1",
])
Expand Down Expand Up @@ -108,7 +108,7 @@ def prepare(self) -> None:
self.steps.extend([
"",
"# Galaxy build stage",
"FROM base as galaxy",
"FROM base AS galaxy",
])

self._insert_global_args()
Expand Down Expand Up @@ -137,7 +137,7 @@ def prepare(self) -> None:
self.steps.extend([
"",
"# Builder build stage",
f"FROM {image} as builder",
f"FROM {image} AS builder",
"ENV PIP_BREAK_SYSTEM_PACKAGES=1",
"WORKDIR /build",
])
Expand All @@ -164,7 +164,7 @@ def prepare(self) -> None:
self.steps.extend([
"",
"# Final build stage",
"FROM base as final",
"FROM base AS final",
"ENV PIP_BREAK_SYSTEM_PACKAGES=1",
])

Expand Down
8 changes: 4 additions & 4 deletions test/unit/test_containerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_v2_custom_builder_image(build_dir_and_ee_yml):
c.prepare()

assert 'ARG EE_BUILDER_IMAGE="quay.io/user/mycustombuilderimage:latest"' in c.steps
assert "FROM $EE_BUILDER_IMAGE as builder" in c.steps
assert "FROM $EE_BUILDER_IMAGE AS builder" in c.steps


def test_v3_various(build_dir_and_ee_yml):
Expand Down Expand Up @@ -295,7 +295,7 @@ def test_v1_builder_image(build_dir_and_ee_yml):
tmpdir, ee_path = build_dir_and_ee_yml(ee_data)
c = make_containerfile(tmpdir, ee_path, run_validate=True)
c.prepare()
assert "FROM $EE_BUILDER_IMAGE as builder" in c.steps
assert "FROM $EE_BUILDER_IMAGE AS builder" in c.steps
assert "COPY _build/scripts/pip_install /output/scripts/pip_install" in c.steps
assert "RUN /output/scripts/pip_install $PYCMD" in c.steps

Expand All @@ -315,7 +315,7 @@ def test_v2_builder_image(build_dir_and_ee_yml):
tmpdir, ee_path = build_dir_and_ee_yml(ee_data)
c = make_containerfile(tmpdir, ee_path, run_validate=True)
c.prepare()
assert "FROM $EE_BUILDER_IMAGE as builder" in c.steps
assert "FROM $EE_BUILDER_IMAGE AS builder" in c.steps
assert "COPY _build/scripts/pip_install /output/scripts/pip_install" in c.steps
assert "RUN /output/scripts/pip_install $PYCMD" in c.steps

Expand All @@ -333,7 +333,7 @@ def test_v2_builder_image_default(build_dir_and_ee_yml):
tmpdir, ee_path = build_dir_and_ee_yml(ee_data)
c = make_containerfile(tmpdir, ee_path, run_validate=True)
c.prepare()
assert "FROM base as builder" in c.steps
assert "FROM base AS builder" in c.steps
assert "COPY _build/scripts/pip_install /output/scripts/pip_install" not in c.steps


Expand Down

0 comments on commit b1273ed

Please sign in to comment.