Skip to content

Commit 9d3de36

Browse files
authored
chore(e2e): install pinned version of yarn v3 using corepack, instead of v1 (#2546)
* RHIDP-6351 Update Dockerfile, workflows, and scripts for Yarn support Signed-off-by: Gustavo Lira <[email protected]> * Update image tagging and upgrade opm version Added an additional image tag including the short SHA to improve traceability in the GitHub workflow. Upgraded the `opm` version in the Dockerfile from 1.23.0 to 1.47.0 Signed-off-by: Gustavo Lira <[email protected]> * Update Dockerfile for streamlined Yarn setup and improvements Refactored Yarn installation process by dynamically detecting the version and ensuring it is activated in shells. Removed unnecessary steps and redundant dependencies, while adding missing tools like `skopeo`. Adjusted `.dockerignore` to include `.yarnrc.yml` in the image context. Signed-off-by: Gustavo Lira <[email protected]> * Refactor Dockerfile to enhance Yarn setup and CLI tools Signed-off-by: Gustavo Lira <[email protected]> * Enable Yarn version display in Docker interactive shells Added a command to echo the Yarn version during interactive shell sessions within the Docker container. This improves visibility and helps confirm the correct Yarn setup for development or debugging purposes. Signed-off-by: Gustavo Lira <[email protected]> * Update Yarn setup and streamline environment configuration Simplified the Yarn setup process in the Dockerfile by consolidating version detection and environment configuration steps. Removed redundant commands and ensured Yarn paths are added to `.bashrc` for interactive shell sessions Signed-off-by: Gustavo Lira <[email protected]> * Remove unnecessary exclusion for .ibm/images/.yarnrc.yml Signed-off-by: Gustavo Lira <[email protected]> --------- Signed-off-by: Gustavo Lira <[email protected]>
1 parent 6380180 commit 9d3de36

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.ibm/images/Dockerfile

+11-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,20 @@ ENV CI=1 \
1616
GOPATH="/go" \
1717
PATH="$GOPATH/bin:/usr/local/go/bin:$PATH"
1818

19-
# Copy the .yarnrc.yml file to the environment
19+
# Copy Yarn configuration files to correctly use the project-defined Yarn version
20+
COPY .yarn /root/.yarn
2021
COPY .yarnrc.yml /root/.yarnrc.yml
22+
RUN rm -f $(which yarn) || true
2123

2224
# Extract the correct version from the file and install
23-
RUN YARN_VERSION=$(awk '/yarnPath:/ {print $2}' /root/.yarnrc.yml | awk -F'[-.]' '{print $(NF-1)"."$NF}') && rm -f /root/.yarnrc.yml
25+
RUN YARN_VERSION=$(awk -F'[-.]' '/yarnPath:/ {print $(NF-3)"."$(NF-2)"."$(NF-1)}' /root/.yarnrc.yml) \
26+
&& echo "Detected Yarn Version: $YARN_VERSION" \
27+
&& corepack enable \
28+
&& corepack prepare "yarn@$YARN_VERSION" --activate \
29+
&& yarn -v \
30+
&& rm -f /root/.yarnrc.yml \
31+
&& echo "export PATH=\"\$HOME/.yarn/bin:\$HOME/.config/yarn/global/node_modules/.bin:\$PATH\"" >> /root/.bashrc \
32+
&& echo 'echo "Yarn version: $(yarn -v)"' >> /root/.bashrc
2433

2534
# Install essential dependencies and Node.js tools
2635
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -30,7 +39,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3039
apache2-utils \
3140
gettext \
3241
curl wget jq colorized-logs && \
33-
npm install -g typescript yarn@$YARN_VERSION && \
3442
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
3543
echo "Node: $(node -v)\nNPM: $(npm -v)\nYarn: $(yarn -v)\nTypeScript: $(tsc -v)"
3644

0 commit comments

Comments
 (0)