Skip to content

Commit 87eff6d

Browse files
authored
feat(browsers): add browsers feature (#3)
* feat: add browsers feature * feat: make firefox arm compatible * docs: add browsers to readme * feat(browsers): handle version resolving * fix(browsers): throw error when arm64 is requested for chrome + chrome testing * fix: use execr directly
1 parent c9293d9 commit 87eff6d

File tree

17 files changed

+697
-0
lines changed

17 files changed

+697
-0
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
feature: [
18+
"browsers",
1819
"docker-out",
1920
"git-lfs",
2021
"go",

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Below is a list with included features, click on the link for more details.
1515

1616
| Name | Description |
1717
| --- | --- |
18+
| [browsers](./features/src/browsers/README.md) | A package which installs various browsers. |
1819
| [docker-out](./features/src/docker-out/README.md) | A feature which installs the Docker client and re-uses the host socket. |
1920
| [git-lfs](./features/src/git-lfs/README.md) | A feature which installs Git LFS. |
2021
| [go](./features/src/go/README.md) | A feature which installs Go. |

build/build.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
////////////////////////////////////////////////////////////
2121

2222
var featureList = []string{
23+
"browsers",
2324
"docker-out",
2425
"git-lfs",
2526
"go",
@@ -50,6 +51,17 @@ func init() {
5051
return nil
5152
})
5253

54+
////////// browsers
55+
gotaskr.Task("Feature:browsers:Package", func() error {
56+
return packageFeature("browsers")
57+
})
58+
gotaskr.Task("Feature:browsers:Test", func() error {
59+
return testFeature("browsers")
60+
})
61+
gotaskr.Task("Feature:browsers:Publish", func() error {
62+
return publishFeature("browsers")
63+
})
64+
5365
////////// docker-out
5466
gotaskr.Task("Feature:docker-out:Package", func() error {
5567
return packageFeature("docker-out")

features/src/browsers/NOTES.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Notes
2+
3+
### System Compatibility
4+
5+
Debian, Ubuntu
6+
7+
### Accessed Urls
8+
9+
Needs access to the following URL for downloading and resolving:
10+
* https://dl.google.com
11+
* https://versionhistory.googleapis.com
12+
* https://googlechromelabs.github.io
13+
* https://download-installer.cdn.mozilla.net
14+
* https://product-details.mozilla.org

features/src/browsers/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Browsers (browsers)
2+
3+
A package which installs various browsers.
4+
5+
## Example Usage
6+
7+
```json
8+
"features": {
9+
"ghcr.io/postfinance/devcontainer-features/browsers:0.1.0": {
10+
"chromeVersion": "none",
11+
"useChromeForTesting": true,
12+
"chromeDownloadUrl": "",
13+
"chromeVersionsUrl": "",
14+
"chromeTestingVersionsUrl": "",
15+
"firefoxVersion": "none",
16+
"firefoxDownloadUrl": "",
17+
"firefoxVersionsUrl": "",
18+
"firefoxVersionResolve": false
19+
}
20+
}
21+
```
22+
23+
## Options
24+
25+
| Option | Description | Type | Default Value | Proposals |
26+
|-----|-----|-----|-----|-----|
27+
| chromeVersion | The version of the Chrome to install. | string | none | none, latest, 126 |
28+
| useChromeForTesting | A flag to indicate if the Chrome for Testing or the default chrome should be used. | boolean | true | true, false |
29+
| chromeDownloadUrl | Override Chrome download base URL. | string | <empty> | |
30+
| chromeVersionsUrl | Override Chrome versions URL. | string | <empty> | |
31+
| chromeTestingVersionsUrl | Override Chrome for Testing versions URL. | string | <empty> | |
32+
| firefoxVersion | The version of the Firefox to install. | string | none | none, latest, 128 |
33+
| firefoxDownloadUrl | Override Firefox download base URL. | string | <empty> | |
34+
| firefoxVersionsUrl | Override Firefox versions URL. | string | <empty> | |
35+
| firefoxVersionResolve | If true, resolves partial Firefox versions (e.g. 142.0) to the highest available patch version (e.g. 142.0.3). | boolean | false | true, false |
36+
37+
## Notes
38+
39+
### System Compatibility
40+
41+
Debian, Ubuntu
42+
43+
### Accessed Urls
44+
45+
Needs access to the following URL for downloading and resolving:
46+
* https://dl.google.com
47+
* https://versionhistory.googleapis.com
48+
* https://googlechromelabs.github.io
49+
* https://download-installer.cdn.mozilla.net
50+
* https://product-details.mozilla.org
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"id": "browsers",
3+
"version": "0.1.0",
4+
"name": "Browsers",
5+
"description": "A package which installs various browsers.",
6+
"options": {
7+
"chromeVersion": {
8+
"type": "string",
9+
"description": "The version of the Chrome to install.",
10+
"default": "none",
11+
"proposals": [
12+
"none",
13+
"latest",
14+
"126"
15+
]
16+
},
17+
"useChromeForTesting": {
18+
"type": "boolean",
19+
"description": "A flag to indicate if the Chrome for Testing or the default chrome should be used.",
20+
"default": true
21+
},
22+
"chromeDownloadUrl": {
23+
"type": "string",
24+
"default": "",
25+
"description": "Override Chrome download base URL."
26+
},
27+
"chromeVersionsUrl": {
28+
"type": "string",
29+
"default": "",
30+
"description": "Override Chrome versions URL."
31+
},
32+
"chromeTestingVersionsUrl": {
33+
"type": "string",
34+
"default": "",
35+
"description": "Override Chrome for Testing versions URL."
36+
},
37+
"firefoxVersion": {
38+
"type": "string",
39+
"description": "The version of the Firefox to install.",
40+
"default": "none",
41+
"proposals": [
42+
"none",
43+
"latest",
44+
"128"
45+
]
46+
},
47+
"firefoxDownloadUrl": {
48+
"type": "string",
49+
"default": "",
50+
"description": "Override Firefox download base URL."
51+
},
52+
"firefoxVersionsUrl": {
53+
"type": "string",
54+
"default": "",
55+
"description": "Override Firefox versions URL."
56+
},
57+
"firefoxVersionResolve": {
58+
"type": "boolean",
59+
"default": false,
60+
"description": "If true, resolves partial Firefox versions (e.g. 142.0) to the highest available patch version (e.g. 142.0.3)."
61+
}
62+
}
63+
}

features/src/browsers/install.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
. ./functions.sh
2+
3+
"./installer_$(detect_arch)" \
4+
-chromeVersion="${CHROMEVERSION:-"none"}" \
5+
-useChromeForTesting="${USECHROMEFORTESTING:-"true"}" \
6+
-firefoxVersion="${FIREFOXVERSION:-"none"}" \
7+
-chromeDownloadUrl="${CHROMEDOWNLOADURL:-""}" \
8+
-chromeVersionsUrl="${CHROMEVERSIONSURL:-""}" \
9+
-chromeTestingVersionsUrl="${CHROMETESTINGVERSIONSURL:-""}" \
10+
-firefoxDownloadUrl="${FIREFOXDOWNLOADURL:-""}" \
11+
-firefoxVersionsUrl="${FIREFOXVERSIONSURL:-""}" \
12+
-firefoxVersionResolve="${FIREFOXVERSIONRESOLVE:-""}"

0 commit comments

Comments
 (0)