Skip to content

Commit e185d3a

Browse files
filipesilvamhevery
authored andcommitted
ci: add codefresh (angular#29305)
PR Close angular#29305
1 parent 6f3052b commit e185d3a

8 files changed

Lines changed: 231 additions & 23 deletions

File tree

.codefresh/Dockerfile.win-1809

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
ARG core=mcr.microsoft.com/windows/servercore:1809
2+
ARG target=mcr.microsoft.com/powershell:windowsservercore-1809
3+
4+
FROM $core as download
5+
6+
ARG node_version=10.13.0
7+
ARG yarn_version=1.13.0
8+
9+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
10+
11+
ENV GPG_VERSION 2.3.4
12+
13+
RUN Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \
14+
Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait
15+
16+
RUN @( \
17+
'94AE36675C464D64BAFA68DD7434390BDBE9B9C5', \
18+
'FD3A5288F042B6850C66B31F09FE44734EB7990E', \
19+
'71DCFD284A79C3B38668286BC97EC7A07EDE3FC1', \
20+
'DD8F2338BAE7501E3DD5AC78C273792F7D83545D', \
21+
'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \
22+
'B9AE9905FFD7803F25714661B63B535A4C206CA9', \
23+
'77984A986EBC2AA786BC0F66B01FBB92821C587A', \
24+
'8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600', \
25+
'4ED778F539E3634C779C87C6D7062848A1AB005C', \
26+
'A48C2BEE680E841632CD4E44F07496B3EB3C1762', \
27+
'B9E2F5981AA6E0CD28160D9FF13993A75599653C' \
28+
) | foreach { \
29+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \
30+
}
31+
32+
ENV NODE_VERSION=$node_version
33+
34+
RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \
35+
gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc
36+
37+
RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
38+
$sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \
39+
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \
40+
Expand-Archive node.zip -DestinationPath C:\ ; \
41+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
42+
43+
ENV YARN_VERSION=$yarn_version
44+
45+
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
46+
Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \
47+
$sig = Get-AuthenticodeSignature yarn.msi ; \
48+
if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \
49+
Write-Output $sig.SignerCertificate.Thumbprint ; \
50+
if (@( \
51+
'7E253367F8A102A91D04829E37F3410F14B68A5F', \
52+
'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \
53+
) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \
54+
Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait
55+
56+
ENV GIT_VERSION 2.20.1
57+
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/v${GIT_VERSION}.windows.1/MinGit-${GIT_VERSION}-busybox-64-bit.zip
58+
ENV GIT_SHA256 9817ab455d9cbd0b09d8664b4afbe4bbf78d18b556b3541d09238501a749486c
59+
60+
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
61+
Invoke-WebRequest -UseBasicParsing $env:GIT_DOWNLOAD_URL -OutFile git.zip; \
62+
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_SHA256) {exit 1} ; \
63+
Expand-Archive git.zip -DestinationPath C:\git; \
64+
Remove-Item git.zip
65+
66+
FROM $target as baseimage
67+
68+
ENV NPM_CONFIG_LOGLEVEL info
69+
70+
COPY --from=download /nodejs /nodejs
71+
COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ]
72+
COPY --from=download /git /git
73+
74+
ARG SETX=/M
75+
RUN setx %SETX% PATH "%PATH%;C:\nodejs;C:\yarn\bin;C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin"
76+
77+
CMD [ "node.exe" ]
78+
79+
FROM baseimage
80+
81+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
82+
83+
RUN Invoke-WebRequest -UseBasicParsing 'https://www.7-zip.org/a/7z1805-x64.exe' -OutFile 7z.exe; \
84+
Start-Process -FilePath 'C:\\7z.exe' -ArgumentList '/S', '/D=C:\\7zip0' -NoNewWindow -Wait; \
85+
Invoke-WebRequest -UseBasicParsing 'http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20180531.tar.xz' -OutFile msys2.tar.xz; \
86+
Start-Process -FilePath 'C:\\7zip\\7z' -ArgumentList 'e', 'msys2.tar.xz' -Wait; \
87+
Start-Process -FilePath 'C:\\7zip\\7z' -ArgumentList 'x', 'msys2.tar', '-oC:\\' -Wait; \
88+
Remove-Item msys2.tar.xz; \
89+
Remove-Item msys2.tar; \
90+
Remove-Item 7z.exe; \
91+
Remove-Item -Recurse 7zip; \
92+
[Environment]::SetEnvironmentVariable('Path', $env:Path + ';C:\msys64\usr\bin', [System.EnvironmentVariableTarget]::Machine); \
93+
[Environment]::SetEnvironmentVariable('BAZEL_SH', 'C:\msys64\usr\bin\bash.exe', [System.EnvironmentVariableTarget]::Machine); \
94+
Invoke-WebRequest -UseBasicParsing 'https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe' -OutFile vc_redist.x64.exe; \
95+
Start-Process 'c:\\vc_redist.x64.exe' -ArgumentList '/Install', '/Passive', '/NoRestart' -NoNewWindow -Wait; \
96+
Remove-Item vc_redist.x64.exe
97+
98+
# Add a fix for https://github.com/docker/for-win/issues/2920 as entry point to the container.
99+
SHELL ["cmd", "/c"]
100+
COPY "fix-msys64.cmd" "C:\\fix-msys64.cmd"
101+
ENTRYPOINT cmd /C C:\\fix-msys64.cmd && cmd /c
102+
103+
CMD ["cmd.exe"]

.codefresh/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# CodeFresh configuration
2+
3+
This folder contains configuration for the [CodeFresh](<https://codefresh.io/> based CI checks for this repository.
4+
5+
## The build pipeline
6+
7+
CodeFresh uses a several pipeline for each repository. The `codefresh.yml` file defines pipeline [build steps](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/introduction-to-codefresh-pipelines/) for this repository.
8+
9+
Run results can be seen in the GitHub checks interface and in the [public pipeline dashboard](https://g.codefresh.io/public/accounts/angular/pipelines/angular/angular/angular).
10+
11+
Although most configuration is done via `pipeline.yml`, some options are only available in the online [pipeline settings](https://g.codefresh.io/pipelines/angular/services?repoOwner=angular&repoName=angular&project=angular%2Fangular&context=github&serviceName=angular%2Fangular), which needs a login to access.
12+
13+
14+
## Caretaker
15+
16+
CodeFresh status can be found at <http://status.codefresh.io/>.
17+
18+
Issues related to the CodeFresh setup should be escalated to the Tools Team via the current caretaker, followed by Alex Eagle and Filipe Silva.
19+
20+
## Rollout strategy
21+
22+
Currently it is only used for tests on Windows platforms, on the master branch, and without pushing user-facing reports. It's only possible to see current builds in the [public pipeline dashboard](https://g.codefresh.io/public/accounts/angular/pipelines/angular/angular/angular).
23+
24+
After a week or two of running like this, we should reassess how stable and reliable it is.
25+
26+
Next steps include:
27+
- building PRs
28+
- showing build status publicly
29+
- blocking PRs that break the build
30+
- expanding the test suite
31+

.codefresh/bazel.rc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# These options are enabled when running on CI
2+
# We do this by copying this file to /etc/bazel.bazelrc at the start of the build.
3+
# See documentation in /docs/BAZEL.md
4+
5+
# Save downloaded repositories in a location that can be cached by CodeFresh. This helps us
6+
# speeding up the analysis time significantly with Bazel managed node dependencies on the CI.
7+
# build --repository_cache=C:/codefresh/volume/bazel_repository_cache
8+
9+
# Don't be spammy in the logs
10+
# TODO(gmagolan): Hide progress again once build performance improves
11+
# Presently, CircleCI can timeout during bazel test ... with the following
12+
# error: Too long with no output (exceeded 10m0s)
13+
# build --noshow_progress
14+
15+
# Print all the options that apply to the build.
16+
# This helps us diagnose which options override others
17+
# (e.g. /etc/bazel.bazelrc vs. tools/bazel.rc)
18+
build --announce_rc
19+
20+
# Workaround https://github.com/bazelbuild/bazel/issues/3645
21+
# Bazel doesn't calculate the memory ceiling correctly when running under Docker.
22+
# Limit Bazel to consuming resources that fit in CodeFresh VMs
23+
# TODO(filipesilva): determine the correct memory limit
24+
build --local_resources=8000,8.0,1.0
25+
26+
# Retry in the event of flakes, eg. https://circleci.com/gh/angular/angular/31309
27+
test --flaky_test_attempts=2
28+
29+
# More details on failures
30+
build --verbose_failures=true
31+
32+
# Include PATH in Windows build/tests
33+
# https://github.com/bazelbuild/rules_typescript/pull/356
34+
build --action_env=PATH
35+
test --action_env=PATH --test_env=PATH
36+
37+
# Exclude tests known to not work on Windows.
38+
39+
# Chrome web tests are currently broken.
40+
test --test_tag_filters=-browser:chromium-local

.codefresh/codefresh.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '1.0'
2+
3+
steps:
4+
BuildImage:
5+
type: build
6+
image_name: node-bazel-windows
7+
working_directory: ./.codefresh
8+
no_cf_cache: true
9+
build_arguments:
10+
- node_version=10.13.0
11+
- yarn_version=1.13.0
12+
dockerfile: ./Dockerfile.win-1809
13+
14+
RunTests:
15+
title: Run Example
16+
image: ${{BuildImage}}
17+
commands:
18+
# Install dependencies
19+
- yarn install --frozen-lockfile --non-interactive --network-timeout 100000 --no-progress
20+
# Create symlinks needed for Windows.
21+
- scripts\windows\create-symlinks.cmd
22+
# Add Bazel CI config
23+
- copy .codefresh\bazel.rc %ProgramData%\bazel.bazelrc
24+
# Run tests
25+
- yarn bazel test //tools/ts-api-guardian:all
26+
- yarn test-ivy-aot //packages/animations/test //packages/common/test //packages/forms/test //packages/http/test //packages/platform-browser/test //packages/platform-browser-dynamic/test //packages/router/test

.codefresh/fix-msys64.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
REM Fix for https://github.com/docker/for-win/issues/2920
3+
REM echo "Fixing msys64 folder..."
4+
REM Touch all .dll files inside C:\msys64\
5+
forfiles /p C:\msys64\ /s /m *.dll /c "cmd /c Copy /B @path+,, >NUL"
6+
REM echo "Fixed msys64 folder."

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
"// 3": "when updating @bazel/bazel version you also need to update the RBE settings in .bazelrc (see https://github.com/angular/angular/pull/27935)",
111111
"devDependencies": {
112112
"@angular/cli": "^7.3.2",
113-
"@bazel/bazel": "0.23.0",
113+
"@bazel/bazel": "0.23.2",
114114
"@bazel/buildifier": "^0.19.2",
115115
"@bazel/ibazel": "~0.9.0",
116116
"@types/minimist": "^1.2.0",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
move /Y packages\upgrade\static\src packages\upgrade\static\src.old
2+
mklink /D packages\upgrade\static\src ..\src

yarn.lock

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,29 @@
8080
semver "5.6.0"
8181
symbol-observable "1.2.0"
8282

83-
"@bazel/[email protected].0":
84-
version "0.23.0"
85-
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.23.0.tgz#11f40d23d282e3034da5c223462f17924adc6c42"
86-
integrity sha512-kEn+SzN9zK2dHeKpTpkZma4ZqZdlzEagYLf2EY7yqRWKpD8oW5MZ2S2JxwvR4w1ZrHCth/x4dFsxwPlNA585JQ==
87-
88-
"@bazel/[email protected].0":
89-
version "0.23.0"
90-
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.23.0.tgz#5c3a0ebc9e68fa3a4bb7a0d05367febca15897a2"
91-
integrity sha512-B+FQOEcrRCM+D/w2hB5uh8j/HiZC2XN4+nthWvgkvdsgiKDXUf0oP/kLCVF/J7T5FAWafky97KDLPPcD6w1Fhg==
92-
93-
"@bazel/[email protected].0":
94-
version "0.23.0"
95-
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.23.0.tgz#9956051d6f66ccf43ed74f0855522c8c673eff97"
96-
integrity sha512-88RfiUwqulva7KmPmgqjYK7EPE1qOwi03jOeDs+U3tb+HUwkyr88t5DKtZU5KBsYjk1UbFFes+RVZtkPmKmcmQ==
97-
98-
"@bazel/[email protected].0":
99-
version "0.23.0"
100-
resolved "https://registry.yarnpkg.com/@bazel/bazel/-/bazel-0.23.0.tgz#22e71d55ccebfd76f6f0bd8a15076160adfac61f"
101-
integrity sha512-6XQ51t4ssEpdCea0rquiGB6cPr5/1Hef4LyHOzYDI8UnLt3pFAKAfOwEqC7HPD21zX3+usa3zSHrID6oOADppg==
83+
"@bazel/[email protected].2":
84+
version "0.23.2"
85+
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.23.2.tgz#619544c9ef444af71d4f4603c0874da951ad1949"
86+
integrity sha512-wLqOtUm9Lr5EMePLqimgePB3GLU9ZJ/FE0ZawcQbKWXROGaGB2cTkOCpPp13T5fGY0Y7tJ/jjzIMBqphfyebLA==
87+
88+
"@bazel/[email protected].2":
89+
version "0.23.2"
90+
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.23.2.tgz#702d1e78bc12d9f0b8a00861f70e51c30e0f435c"
91+
integrity sha512-b2CEoceQdaG5A2pXLbZcQZYk148wpPE141y6o4D9BL8JhbeW0TcnwtCziPVnSiW+nublDk9iNR3eVuNgsxgypw==
92+
93+
"@bazel/[email protected].2":
94+
version "0.23.2"
95+
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.23.2.tgz#3c48c8615c2c9c6ee8c67b8f302e94324db153e2"
96+
integrity sha512-wjcgN3ecj47osfgX3asiRb37wBd0RNgaTXejOwc7ZUCHKazDUkZzQyYH5S/4RgLaj9sT+cMEXVo1RI4nNRMqIA==
97+
98+
"@bazel/[email protected].2":
99+
version "0.23.2"
100+
resolved "https://registry.yarnpkg.com/@bazel/bazel/-/bazel-0.23.2.tgz#94ac42cc29c5bcb6b35fe112624d94c803dd78a8"
101+
integrity sha512-FP7sPD13sf0B2c2484DzJl2WzonrYJL2fAKgKl4Of8nBwlgNymvm2JAr3tZE3Ew+s9UwnEBrBDuf3eLn8xC9eg==
102102
optionalDependencies:
103-
"@bazel/bazel-darwin_x64" "0.23.0"
104-
"@bazel/bazel-linux_x64" "0.23.0"
105-
"@bazel/bazel-win32_x64" "0.23.0"
103+
"@bazel/bazel-darwin_x64" "0.23.2"
104+
"@bazel/bazel-linux_x64" "0.23.2"
105+
"@bazel/bazel-win32_x64" "0.23.2"
106106

107107
108108
version "0.19.2"

0 commit comments

Comments
 (0)