Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit d25c417

Browse files
authored
update install.sh (#1057)
* update install.sh * delete Dockerfile * place back a test dockerfile * add regression CI * on PR
1 parent a86fbaf commit d25c417

File tree

5 files changed

+52
-11
lines changed

5 files changed

+52
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Container Features Regression Test
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
paths:
8+
- 'script-library/container-features/**'
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- 'script-library/container-features/**'
14+
15+
jobs:
16+
test-script-library:
17+
name: Run test script
18+
if: "!contains(github.event.head_commit.message, 'Automated update') && !contains(github.event.head_commit.message, 'CI ignore')"
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Free more space
22+
id: free_space
23+
run: |
24+
set -e
25+
# Ensure enough space is available for build
26+
sudo apt-get autoremove -y
27+
sudo apt-get clean -y
28+
sudo rm -rf /usr/share/dotnet
29+
30+
- name: Checkout
31+
id: checkout
32+
uses: actions/checkout@v1
33+
34+
- name: Run test
35+
id: run_test_script
36+
run: |
37+
set -e
38+
cd ./script-library/container-features
39+
./test.sh

script-library/container-features/src/install.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
set -e
33

44
set -a
5-
. /tmp/library-scripts/features.env
5+
. /tmp/build-features/features.env
66
set +a
77

8-
chmod +x /tmp/library-scripts/*.sh
8+
chmod +x *.sh
99

1010
# Execute option scripts if correct environment variable is set to "true"
1111
while IFS= read -r feature_line; do
@@ -17,9 +17,9 @@ while IFS= read -r feature_line; do
1717
feature_script_and_args="${feature_script_and_args%\"}"
1818
# Execute the script line - but do not quote so arguments can be included in the
1919
echo "${feature_script_and_args#\"}"
20-
eval "/tmp/library-scripts/${feature_script_and_args#\"}"
20+
eval "./${feature_script_and_args#\"}"
2121
fi
22-
done < /tmp/library-scripts/feature-scripts.env
22+
done < ./feature-scripts.env
2323

2424
# Clean up
2525
apt-get autoremove -y

script-library/container-features/src/java-wrapper.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ USERNAME=${3:-"automatic"}
99
UPDATE_RC=${4:-"true"}
1010
ADDITIONAL_JAVA_VERSION=11
1111

12-
/tmp/library-scripts/java-debian.sh "${JAVA_VERSION}" "${SDKMAN_DIR}" "${USERNAME}" "${UPDATE_RC}"
12+
/tmp/build-features/java-debian.sh "${JAVA_VERSION}" "${SDKMAN_DIR}" "${USERNAME}" "${UPDATE_RC}"
1313

1414
# If the user selected JDK 8, install the JDK 11 as well
1515
if echo "${JAVA_VERSION}" | grep -E '^8([\s\.]|$)' > /dev/null 2>&1; then
16-
/tmp/library-scripts/java-debian.sh "${ADDITIONAL_JAVA_VERSION}" "${SDKMAN_DIR}" "${USERNAME}" "${UPDATE_RC}"
16+
/tmp/build-features/java-debian.sh "${ADDITIONAL_JAVA_VERSION}" "${SDKMAN_DIR}" "${USERNAME}" "${UPDATE_RC}"
1717
fi

script-library/container-features/src/Dockerfile renamed to script-library/container-features/test.Dockerfile

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ FROM $BASE_IMAGE
33

44
USER root
55

6-
COPY *.env *.sh /tmp/library-scripts/
7-
RUN /tmp/library-scripts/install.sh \
8-
&& rm -rf /tmp/library-scripts
6+
COPY . /tmp/build-features/
7+
8+
RUN cd /tmp/build-features \
9+
&& chmod +x ./install.sh \
10+
&& ./install.sh
911

1012
#{containerEnv}
1113

1214
ARG IMAGE_USER=root
13-
USER $IMAGE_USER
15+
USER $IMAGE_USER

script-library/container-features/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if [ ! -z "${PLATFORMS}" ]; then
2121
docker run --privileged --rm tonistiigi/binfmt --install ${PLATFORMS}
2222
PLATFORMS_ARG="--builder vscode-dev-containers --platform ${PLATFORMS}"
2323
fi
24-
docker buildx build --progress plain --load ${PLATFORMS_ARG} --build-arg BASE_IMAGE=$IMAGE_TO_TEST -t container-features-regression out
24+
docker buildx build --progress plain --load ${PLATFORMS_ARG} --build-arg BASE_IMAGE=$IMAGE_TO_TEST -t container-features-regression -f test.Dockerfile out
2525
docker run --init --privileged container-features-regression bash -c 'uname -m && env'
2626

2727
# Remove features.env from out folder so we can use it to test the VS Code extension

0 commit comments

Comments
 (0)