Compare commits

...

3 Commits

Author SHA1 Message Date
Natalie Arellano 8bda540dea Try to fix pack acceptance, continued
Use a released version of pack when running pack acceptance (avoids v0.28.0-rc1).

In lifecycle CI, pack acceptance tests are failing on Windows when the pack version is v0.28.0-rc1.
The previous commit, which attempted to make lifecycle CI match pack CI by using go 1.17,
  did not fix the issue.
It was manually confirmed on a Windows dev worker that pack acceptance passes
  with the same pack version and the same lifecycle version that are failing in CI.
Therefore, the failling tests do not appear to relate to the lifecycle,
  and are instead likely due to other unknown differences in the CI environments that should be determined later.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-11-28 15:30:56 -05:00
Natalie Arellano 91b7360a76 Try to fix pack acceptance
In lifecycle CI, the pack acceptance tests are failing on Windows,
  due to the actual diff ID for builder extension layers being different
  from what is hard-coded in the tests (see https://github.com/buildpacks/lifecycle/actions/runs/3567296961/jobs/5995096218).
In pack CI, the acceptance tests are passing.
Since the lifecycle in use should not affect how builder layers are created,
  and the only difference between lifecycle CI and pack CI appears to be the go version,
  try switching to go 1.17 to see if this fixes the issue.
If this works, it may be interesting to understand why go 1.17 produces different tars
  for extension layers (but not buildpack layers), but this is an issue for the pack repo,
  not the lifecycle repo.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-11-28 13:21:24 -05:00
Natalie Arellano e63de8dc71 Fix: set HOME for provided user after build image extension (#960) (#964)
Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-11-28 12:46:05 -05:00
5 changed files with 16 additions and 2 deletions

View File

@ -262,7 +262,7 @@ jobs:
- name: Run pack acceptance
run: |
cd pack
git checkout $(git describe --abbrev=0 --tags) # check out the latest tag
git checkout $(git describe --abbrev=0 --tags --exclude *-rc*) # check out the latest tag
LIFECYCLE_PATH="../lifecycle-v${{ env.LIFECYCLE_VERSION }}+linux.x86-64.tgz" \
LIFECYCLE_IMAGE="buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}" \
make acceptance
@ -328,7 +328,7 @@ jobs:
- name: Run pack acceptance
run: |
cd pack
git checkout $(git describe --abbrev=0 --tags) # check out the latest tag
git checkout $(git describe --abbrev=0 --tags --exclude *-rc*) # check out the latest tag
$env:LIFECYCLE_PATH="..\lifecycle-v${{ env.LIFECYCLE_VERSION }}+windows.x86-64.tgz"
$env:LIFECYCLE_IMAGE="buildpacksio/lifecycle:${{ env.LIFECYCLE_IMAGE_TAG }}"
make acceptance

View File

@ -133,6 +133,7 @@ func testExtenderFunc(platformAPI string) func(t *testing.T, when spec.G, it spe
h.AssertStringContains(t, firstOutput, "Hello Extensions buildpack\ncurl") // output by buildpack, shows that curl was installed on the build image
t.Log("sets environment variables from the extended build image in the build context")
h.AssertStringContains(t, firstOutput, "CNB_STACK_ID for buildpack: stack-id-from-ext-tree")
h.AssertStringContains(t, firstOutput, "HOME for buildpack: /home/cnb")
t.Log("cleans the kaniko directory")
fis, err := os.ReadDir(kanikoDir)

View File

@ -1,3 +1,12 @@
FROM ubuntu:bionic
ARG cnb_uid=1234
ARG cnb_gid=1000
ENV CNB_USER_ID=${cnb_uid}
ENV CNB_GROUP_ID=${cnb_gid}
COPY ./container/ /
RUN groupadd cnb --gid ${cnb_gid} && \
useradd --uid ${cnb_uid} --gid ${cnb_gid} -m -s /bin/bash cnb

View File

@ -7,3 +7,4 @@ curl --version
tree /layers
echo "CNB_STACK_ID for buildpack: ${CNB_STACK_ID}"
echo "HOME for buildpack: ${HOME}"

View File

@ -75,6 +75,9 @@ func (e *extendCmd) Exec() error {
if err = priv.RunAs(e.UID, e.GID); err != nil {
return cmd.FailErr(err, fmt.Sprintf("exec as user %d:%d", e.UID, e.GID))
}
if err = priv.SetEnvironmentForUser(e.UID); err != nil {
return cmd.FailErr(err, fmt.Sprintf("set environment for user %d", e.UID))
}
buildCmd := buildCmd{
groupPath: e.GroupPath,
planPath: e.PlanPath,