Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions .devcontainer/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# syntax=docker/dockerfile:1

ARG GH_VERSION=2.94.0
ARG GH_AW_VERSION=0.79.6

FROM ubuntu:26.04@sha256:f3d28607ddd78734bb7f71f117f3c6706c666b8b76cbff7c9ff6e5718d46ff64 AS downloader

Check warning on line 6 in .devcontainer/base/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use either the version tag or the digest for the image instead of both.

See more on https://sonarcloud.io/project/issues?id=philips-software_amp-devcontainer&issues=AZ67UDy9HcjPfP_Kp0rr&open=AZ67UDy9HcjPfP_Kp0rr&pullRequest=1304

ARG GH_VERSION
ARG GH_AW_VERSION
ARG TARGETARCH

SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"]

# hadolint ignore=DL3008
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked <<EOF
apt-get update && apt-get install -y --no-install-recommends ca-certificates wget

case "${TARGETARCH}" in
amd64) GH_SHA=a757f1ba6db18f4de8cbadb244843a5f89bc75b5e7c6fc127d2bd77fbd12ed62
GH_AW_SHA=77e69ddcda854560f827045ae59f87fdf6a07f07d5ab37a750317b3368eb6c2e ;;
arm64) GH_SHA=705a23b70b0f1b7ba4c302fdcef392ce3edaacfa7ce8e85e4d93d72ea800a538
GH_AW_SHA=1054d302486b6e56a27095a1b887e9ec0ffdfe009006835dcf3c6b931bf9d040 ;;
esac

wget --no-hsts -qO /gh.tar.gz "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${TARGETARCH}.tar.gz"
echo "${GH_SHA} /gh.tar.gz" | sha256sum -c -
mkdir /tmp/gh && tar xzf /gh.tar.gz --strip-components=1 -C /tmp/gh
cp /tmp/gh/bin/gh /gh

wget --no-hsts -qO /gh-aw "https://github.com/github/gh-aw/releases/download/v${GH_AW_VERSION}/linux-${TARGETARCH}"
echo "${GH_AW_SHA} /gh-aw" | sha256sum -c -
chmod +x /gh-aw
EOF

FROM ubuntu:26.04@sha256:f3d28607ddd78734bb7f71f117f3c6706c666b8b76cbff7c9ff6e5718d46ff64 AS extractor

ARG BATS_CORE_VERSION=1.13.0
Expand All @@ -16,9 +49,13 @@
ADD --checksum=sha256:e305df20c4c36cba4570e10f1cd824efb1ae71d88b5ef474550781ebee04192f \
https://github.com/bats-core/bats-assert/archive/refs/tags/v${BATS_ASSERT_VERSION}.tar.gz /bats-assert.tar.gz

RUN tar xzf /bats-core.tar.gz && mv bats-core-*/ bats-core \
RUN --mount=from=downloader,source=/gh,target=/dl/gh \
--mount=from=downloader,source=/gh-aw,target=/dl/gh-aw \
tar xzf /bats-core.tar.gz && mv bats-core-*/ bats-core \
&& tar xzf /bats-support.tar.gz && mv bats-support-*/ bats-support \
&& tar xzf /bats-assert.tar.gz && mv bats-assert-*/ bats-assert
&& tar xzf /bats-assert.tar.gz && mv bats-assert-*/ bats-assert \
&& cp /dl/gh /gh \
&& cp /dl/gh-aw /gh-aw

FROM ubuntu:26.04@sha256:f3d28607ddd78734bb7f71f117f3c6706c666b8b76cbff7c9ff6e5718d46ff64

Expand Down Expand Up @@ -51,6 +88,11 @@
cp -r /src/bats-support /usr/local/bats-support
cp -r /src/bats-assert /usr/local/bats-assert

# Install gh and gh-aw extension
cp /src/gh /usr/local/bin/gh
mkdir -p /root/.local/share/gh/extensions/gh-aw
cp /src/gh-aw /root/.local/share/gh/extensions/gh-aw/gh-aw

# Generate locale
sed -i '/C.UTF-8/s/^# //' /etc/locale.gen
locale-gen
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/cpp/devcontainer-metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"postStartCommand": "gh auth setup-git",
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/rust/devcontainer-metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"postStartCommand": "gh auth setup-git",
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
Expand Down
2 changes: 2 additions & 0 deletions .github/TOOL_VERSION_ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ It's time for our quarterly tool version check! This issue serves as a reminder
- [ ] [bats-core](https://github.com/bats-core/bats-core)
- [ ] [bats-support](https://github.com/bats-core/bats-support)
- [ ] [bats-assert](https://github.com/bats-core/bats-assert)
- [ ] [gh](https://github.com/cli/cli)
- [ ] [gh-aw](https://github.com/github/gh-aw)

### ⚙️ amp-devcontainer-cpp

Expand Down
12 changes: 12 additions & 0 deletions test/base/integration-tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,15 @@ setup() {
assert_success
assert_output --partial "OK"
}

@test "gh is installed and functional" {
run gh --version
assert_success
assert_output --partial "gh version"
}

@test "gh aw extension is installed" {
run gh extension list
assert_success
assert_output --partial "gh-aw"
}
Loading