Skip to content

Commit 34710a8

Browse files
committed
WIP: devspaces image validation
1 parent 196ec71 commit 34710a8

File tree

4 files changed

+315
-126
lines changed

4 files changed

+315
-126
lines changed

.github/workflows/ack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ concurrency:
77

88
on:
99
pull_request_target:
10-
types: [opened, labeled, unlabeled, synchronize]
10+
types: [labeled, unlabeled]
1111

1212
jobs:
1313
ack:

.github/workflows/tox.yml

Lines changed: 228 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -27,146 +27,250 @@ permissions:
2727
id-token: write # tox/check job
2828

2929
jobs:
30-
tox:
31-
uses: ansible/team-devtools/.github/workflows/tox.yml@main
32-
with:
33-
run_pre: ./tools/test-setup.sh
34-
max_python: "3.13"
35-
default_python: "3.10" # min version, for 'lint' in particular
36-
jobs_producing_coverage: 7
37-
other_names_also: |
38-
devspaces
39-
ee-amd64:tox -e ee:runner=devtools-multiarch-builder
40-
ee-arm64:tox -e ee:runner=ubuntu-24.04-arm64-2core
41-
secrets: inherit # needed for logging to the ghcr.io registry
42-
43-
codeql:
44-
name: codeql
45-
runs-on: ubuntu-latest
46-
permissions:
47-
actions: read
48-
contents: read
49-
security-events: write
50-
51-
strategy:
52-
fail-fast: false
53-
matrix:
54-
language: ["python"]
55-
30+
smoke:
31+
# persistent self-hosted runner so minikube would not need to be installed each time
32+
runs-on: ubuntu-24.04-amd64-azure
33+
# ubuntu-24.04
5634
steps:
57-
- name: Checkout repository
35+
- name: Checkout source code
5836
uses: actions/checkout@v4
5937

60-
# Initializes the CodeQL tools for scanning.
61-
- name: Initialize CodeQL
62-
uses: github/codeql-action/init@v3
63-
with:
64-
languages: ${{ matrix.language }}
65-
# If you wish to specify custom queries, you can do so here or in a config file.
66-
# By default, queries listed here will override any specified in a config file.
67-
# Prefix the list here with "+" to use these queries and those in the config file.
38+
- run: ./tools/test-setup.sh
39+
# - name: Prepare Che-Code Dockerfile ( remove tests )
40+
# run: |
41+
# #
42+
# # truncate Dockerfile, remove section that runs tests
43+
# #
44+
# cp -f build/dockerfiles/linux-libc-ubi8.Dockerfile build/dockerfiles/linux-libc-ubi8.no-test.Dockerfile
45+
# REMOVE_FROM="### Beginning of tests"
46+
# REMOVE_TO="### Ending of tests"
47+
# sed -i "/${REMOVE_FROM}/,/${REMOVE_TO}/{/${REMOVE_FROM}/n;/${REMOVE_TO}/!d;}" build/dockerfiles/linux-libc-ubi8.no-test.Dockerfile
48+
49+
# #
50+
# # show the Dockerfile
51+
# #
52+
# cat build/dockerfiles/linux-libc-ubi8.no-test.Dockerfile
53+
54+
# - name: Compile Che-Code editor
55+
# run: |
56+
# #
57+
# # build linux-libc-ubi8-amd64:latest docker image
58+
# #
59+
# docker image prune -a -f
60+
# docker build --memory-swap -1 --memory 12g -f build/dockerfiles/linux-libc-ubi8.no-test.Dockerfile -t linux-libc-ubi8-amd64 .
61+
62+
# - name: Build Che-Code Docker image
63+
# run: |
64+
# #
65+
# # build che-code:latest docker image
66+
# #
67+
# cp -f build/dockerfiles/assembly.Dockerfile build/dockerfiles/assembly.copy.Dockerfile
68+
# REPLACE_FROM="FROM linux-musl-amd64 as linux-musl-content"
69+
# sed -i -r -e "s|${REPLACE_FROM}||" build/dockerfiles/assembly.copy.Dockerfile
70+
# REPLACE_FROM="COPY --from=linux-musl-content --chown=0:0 /checode-linux-musl /mnt/rootfs/checode-linux-musl"
71+
# sed -i -r -e "s|${REPLACE_FROM}||" build/dockerfiles/assembly.copy.Dockerfile
72+
# REPLACE_FROM="FROM linux-libc-ubi9-amd64 as linux-libc-ubi9-content"
73+
# sed -i -r -e "s|${REPLACE_FROM}||" build/dockerfiles/assembly.copy.Dockerfile
74+
# REPLACE_FROM="COPY --from=linux-libc-ubi9-content --chown=0:0 /checode-linux-libc/ubi9 /mnt/rootfs/checode-linux-libc/ubi9"
75+
# sed -i -r -e "s|${REPLACE_FROM}||" build/dockerfiles/assembly.copy.Dockerfile
76+
77+
# export DOCKER_BUILDKIT=1
78+
# docker build -f build/dockerfiles/assembly.copy.Dockerfile -t che-code .
79+
80+
# docker tag che-code:latest che-code:next
81+
# docker save -o /tmp/che-code-latest.tar che-code:latest che-code:next
82+
83+
# - name: Display docker images
84+
# run: |
85+
# docker images
6886

69-
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
70-
# queries: security-extended,security-and-quality
87+
# - name: Cleanup docker images
88+
# run: |
89+
# docker system prune -af
7190

72-
- name: Autobuild
73-
uses: github/codeql-action/autobuild@v3
91+
# - name: Disk free
92+
# run: |
93+
# df -h
7494

75-
- name: Perform CodeQL Analysis
76-
uses: github/codeql-action/analyze@v3
95+
- name: Start minikube
96+
id: run-minikube
97+
uses: che-incubator/setup-minikube-action@next
7798
with:
78-
category: "/language:${{matrix.language}}"
79-
80-
publish-ee:
81-
# environment: release # approval
82-
runs-on: ubuntu-24.04
83-
needs:
84-
- tox
85-
# if: github.ref == 'refs/heads/main'
86-
# github.event_name == 'release' && github.event.action == 'published'
87-
steps:
88-
- name: Check out repository
89-
uses: actions/checkout@v4
99+
minikube-version: v1.34.0
90100

91-
- name: pull-merge-push for the the two arch images under a single manifest
92-
env:
93-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
94-
run: ./tools/ee.sh --publish "${{ github.event.release.tag_name || github.sha }}" "${{ (github.event_name == 'release' && github.event.action == 'published') || '--dry' }}"
95-
96-
publish-devspaces:
97-
runs-on: ubuntu-24.04
98-
needs:
99-
- codeql
100-
- tox
101-
if: github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'published')
102-
steps:
103-
- name: Push image to ghcr.io as ansible-devspaces-tmp:${GITHUB_SHA}
104-
run: |
105-
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
106-
docker pull "ghcr.io/ansible/ansible-devspaces-tmp:${GITHUB_SHA}"
107-
docker tag "ghcr.io/ansible/ansible-devspaces-tmp:${GITHUB_SHA}" "ghcr.io/ansible/ansible-devspaces:${GITHUB_SHA}"
101+
- name: smoke
102+
run: ./tools/smoke.sh
108103

109-
- name: Push image to ghcr.io as ${{ github.event.release.tag_name }}
110-
if: github.event_name == 'release' && github.event.action == 'published'
104+
- name: Bump logs
105+
if: always()
111106
run: |
112-
docker tag "ghcr.io/ansible/ansible-devspaces:${GITHUB_SHA}" "ghcr.io/ansible/ansible-devspaces:${{ github.event.release.tag_name }}"
113-
docker tag "ghcr.io/ansible/ansible-devspaces:${GITHUB_SHA}" "ghcr.io/ansible/ansible-devspaces:latest"
114-
docker push "ghcr.io/ansible/ansible-devspaces:${{ github.event.release.tag_name }}"
115-
docker push "ghcr.io/ansible/ansible-devspaces:latest"
116-
117-
publish-wheel:
118-
needs:
119-
- codeql
120-
- tox
121-
if: github.event_name == 'release' && github.event.action == 'published'
122-
environment: release # approval
123-
runs-on: ubuntu-24.04
124-
env:
125-
FORCE_COLOR: 1
126-
PY_COLORS: 1
127-
TOXENV: pkg
128-
TOX_EXTRA_BINDEP: 0
129-
steps:
130-
- name: Switch to using Python 3.10 by default
131-
uses: actions/setup-python@v5
132-
with:
133-
python-version: "3.10"
107+
NS=admin-che
108+
TARGET_DIR="/tmp/devworkspace-happy-path-artifacts/${NS}-info"
109+
mkdir -p "$TARGET_DIR"
110+
for POD in $(kubectl get pods -o name -n ${NS}); do
111+
for CONTAINER in $(kubectl get -n ${NS} ${POD} -o jsonpath="{.spec.containers[*].name}"); do
112+
echo "[INFO] Downloading logs $POD/$CONTAINER in $NS"
113+
# container name includes `pod/` prefix. remove it
114+
LOGS_FILE=$TARGET_DIR/$(echo ${POD}-${CONTAINER}.log | sed 's|pod/||g')
115+
kubectl logs ${POD} -c ${CONTAINER} -n ${NS} > $LOGS_FILE || true
116+
done
117+
done
118+
echo "[INFO] Bumping events in namespace ${NS}"
119+
kubectl get events -n $NS > $TARGET_DIR/events.log || true
134120
135-
- name: Install tox
136-
run: python3 -m pip install --user "tox>=4.0.0"
121+
- name: Store e2e artifacts
122+
if: always()
123+
uses: actions/upload-artifact@v3
124+
with:
125+
name: e2e-artifacts
126+
path: /tmp/tests
137127

138-
- name: Check out src from Git
139-
uses: actions/checkout@v4
128+
- name: Store k8s logs
129+
if: always()
130+
uses: actions/upload-artifact@v3
140131
with:
141-
fetch-depth: 0 # needed by setuptools-scm
142-
submodules: true
132+
name: k8s-logs
133+
path: /tmp/devworkspace-happy-path-artifacts/admin-che-info
134+
# tox:
135+
# uses: ansible/team-devtools/.github/workflows/tox.yml@main
136+
# with:
137+
# run_pre: ./tools/test-setup.sh
138+
# max_python: "3.13"
139+
# default_python: "3.10" # min version, for 'lint' in particular
140+
# jobs_producing_coverage: 7
141+
# other_names_also: |
142+
# devspaces
143+
# ee-amd64:tox -e ee:runner=devtools-multiarch-builder
144+
# ee-arm64:tox -e ee:runner=ubuntu-24.04-arm64-2core
145+
# secrets: inherit # needed for logging to the ghcr.io registry
143146

144-
- name: Build dists
145-
run: python3 -m tox
147+
# codeql:
148+
# name: codeql
149+
# runs-on: ubuntu-latest
150+
# permissions:
151+
# actions: read
152+
# contents: read
153+
# security-events: write
146154

147-
- name: Publish to pypi.org
148-
if: >- # "create" workflows run separately from "push" & "pull_request"
149-
github.event_name == 'release'
150-
uses: pypa/gh-action-pypi-publish@release/v1
155+
# strategy:
156+
# fail-fast: false
157+
# matrix:
158+
# language: ["python"]
151159

152-
forum-post:
153-
if: github.event_name == 'release' && github.event.action == 'published'
154-
needs:
155-
- publish-wheel
156-
- publish-ee
157-
- publish-devspaces
158-
runs-on: ubuntu-24.04
160+
# steps:
161+
# - name: Checkout repository
162+
# uses: actions/checkout@v4
159163

160-
steps:
161-
- name: Retreive the forum post script from team-devtools
162-
run: curl -O https://raw.githubusercontent.com/ansible/team-devtools/main/.github/workflows/forum_post.py
164+
# # Initializes the CodeQL tools for scanning.
165+
# - name: Initialize CodeQL
166+
# uses: github/codeql-action/init@v3
167+
# with:
168+
# languages: ${{ matrix.language }}
169+
# # If you wish to specify custom queries, you can do so here or in a config file.
170+
# # By default, queries listed here will override any specified in a config file.
171+
# # Prefix the list here with "+" to use these queries and those in the config file.
163172

164-
- name: Run the forum post script
165-
run: python3 forum_post.py ${{ github.event.repository.full_name }} ${{ github.event.release.tag_name }} ${{ secrets.FORUM_KEY }} ${{ secrets.FORUM_USER }}
173+
# # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
174+
# # queries: security-extended,security-and-quality
166175

167-
push:
168-
if: >
169-
github.event_name == 'push' && contains(
170-
fromJSON('["refs/heads/main", "refs/heads/releases", "refs/heads/stable"]'),
171-
github.ref)
172-
uses: ansible/team-devtools/.github/workflows/push.yml@main
176+
# - name: Autobuild
177+
# uses: github/codeql-action/autobuild@v3
178+
179+
# - name: Perform CodeQL Analysis
180+
# uses: github/codeql-action/analyze@v3
181+
# with:
182+
# category: "/language:${{matrix.language}}"
183+
184+
# publish-ee:
185+
# # environment: release # approval
186+
# runs-on: ubuntu-24.04
187+
# needs:
188+
# - tox
189+
# # if: github.ref == 'refs/heads/main'
190+
# # github.event_name == 'release' && github.event.action == 'published'
191+
# steps:
192+
# - name: Check out repository
193+
# uses: actions/checkout@v4
194+
195+
# - name: pull-merge-push for the the two arch images under a single manifest
196+
# env:
197+
# GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
198+
# run: ./tools/ee.sh --publish "${{ github.event.release.tag_name || github.sha }}" "${{ (github.event_name == 'release' && github.event.action == 'published') || '--dry' }}"
199+
200+
# publish-devspaces:
201+
# runs-on: ubuntu-24.04
202+
# needs:
203+
# - codeql
204+
# - tox
205+
# if: github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'published')
206+
# steps:
207+
# - name: Push image to ghcr.io as ansible-devspaces-tmp:${GITHUB_SHA}
208+
# run: |
209+
# echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
210+
# docker pull "ghcr.io/ansible/ansible-devspaces-tmp:${GITHUB_SHA}"
211+
# docker tag "ghcr.io/ansible/ansible-devspaces-tmp:${GITHUB_SHA}" "ghcr.io/ansible/ansible-devspaces:${GITHUB_SHA}"
212+
213+
# - name: Push image to ghcr.io as ${{ github.event.release.tag_name }}
214+
# if: github.event_name == 'release' && github.event.action == 'published'
215+
# run: |
216+
# docker tag "ghcr.io/ansible/ansible-devspaces:${GITHUB_SHA}" "ghcr.io/ansible/ansible-devspaces:${{ github.event.release.tag_name }}"
217+
# docker tag "ghcr.io/ansible/ansible-devspaces:${GITHUB_SHA}" "ghcr.io/ansible/ansible-devspaces:latest"
218+
# docker push "ghcr.io/ansible/ansible-devspaces:${{ github.event.release.tag_name }}"
219+
# docker push "ghcr.io/ansible/ansible-devspaces:latest"
220+
221+
# publish-wheel:
222+
# needs:
223+
# - codeql
224+
# - tox
225+
# if: github.event_name == 'release' && github.event.action == 'published'
226+
# environment: release # approval
227+
# runs-on: ubuntu-24.04
228+
# env:
229+
# FORCE_COLOR: 1
230+
# PY_COLORS: 1
231+
# TOXENV: pkg
232+
# TOX_EXTRA_BINDEP: 0
233+
# steps:
234+
# - name: Switch to using Python 3.10 by default
235+
# uses: actions/setup-python@v5
236+
# with:
237+
# python-version: "3.10"
238+
239+
# - name: Install tox
240+
# run: python3 -m pip install --user "tox>=4.0.0"
241+
242+
# - name: Check out src from Git
243+
# uses: actions/checkout@v4
244+
# with:
245+
# fetch-depth: 0 # needed by setuptools-scm
246+
# submodules: true
247+
248+
# - name: Build dists
249+
# run: python3 -m tox
250+
251+
# - name: Publish to pypi.org
252+
# if: >- # "create" workflows run separately from "push" & "pull_request"
253+
# github.event_name == 'release'
254+
# uses: pypa/gh-action-pypi-publish@release/v1
255+
256+
# forum-post:
257+
# if: github.event_name == 'release' && github.event.action == 'published'
258+
# needs:
259+
# - publish-wheel
260+
# - publish-ee
261+
# - publish-devspaces
262+
# runs-on: ubuntu-24.04
263+
264+
# steps:
265+
# - name: Retreive the forum post script from team-devtools
266+
# run: curl -O https://raw.githubusercontent.com/ansible/team-devtools/main/.github/workflows/forum_post.py
267+
268+
# - name: Run the forum post script
269+
# run: python3 forum_post.py ${{ github.event.repository.full_name }} ${{ github.event.release.tag_name }} ${{ secrets.FORUM_KEY }} ${{ secrets.FORUM_USER }}
270+
271+
# push:
272+
# if: >
273+
# github.event_name == 'push' && contains(
274+
# fromJSON('["refs/heads/main", "refs/heads/releases", "refs/heads/stable"]'),
275+
# github.ref)
276+
# uses: ansible/team-devtools/.github/workflows/push.yml@main

0 commit comments

Comments
 (0)