Skip to content

Commit 6cda2d5

Browse files
authored
Merge pull request #8 from eoap/develop
CI update - uses upstream https://github.com/eoap/eoap-cwl-release-workflow
2 parents 124276f + 49b5d54 commit 6cda2d5

9 files changed

Lines changed: 112 additions & 149 deletions

File tree

.github/workflows/build.yaml

Lines changed: 12 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -2,142 +2,17 @@ name: build
22

33
on:
44
push:
5-
branches:
6-
- develop
7-
- main
8-
paths:
9-
- 'command-line-tools/**'
10-
- .github/**
11-
- docs/**
12-
- cwl-workflow/*.cwl
13-
- codemeta.json
5+
branches: [develop, main]
6+
tags:
7+
- 'v*'
148

159
jobs:
16-
validate:
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v2
20-
- uses: actions/setup-python@v2
21-
with:
22-
python-version: 3.x
23-
- run: pip install cwltool
24-
- run: cwltool --validate cwl-workflow/app-water-bodies-cloud-native.cwl
25-
- run: cwltool --validate cwl-workflow/app-water-body-cloud-native.cwl
26-
- run: cwltool --validate cwl-workflow/app-water-body.cwl
27-
- run: cwltool --validate cwl-workflow/app-water-bodies-cloud-native-geoparquet.cwl
28-
29-
version:
30-
needs: validate
31-
runs-on: ubuntu-latest
32-
outputs:
33-
app-version: ${{ steps.set-version.outputs.version }}
34-
steps:
35-
- uses: actions/checkout@v2
36-
- run: echo "APP_VERSION=$(jq -r .version codemeta.json)" >> $GITHUB_ENV
37-
- run: echo app version is $APP_VERSION
38-
- id: set-version
39-
run: echo "::set-output name=version::$APP_VERSION"
40-
41-
container-build:
42-
needs: version
43-
runs-on: ubuntu-latest
44-
strategy:
45-
matrix:
46-
step: [crop, norm_diff, otsu, stac, stage, stac-geoparquet]
47-
steps:
48-
- uses: actions/checkout@v2
49-
- run: echo version ${{ needs.version.outputs.app-version }}
50-
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
51-
- name: build & push image
52-
run: |
53-
IMAGE_ID=ghcr.io/eoap/advanced-tooling/${{ matrix.step }}
54-
docker build command-line-tools/${{ matrix.step }} \
55-
--file command-line-tools/${{ matrix.step }}/Dockerfile \
56-
--tag ${{ matrix.step }}
57-
docker tag ${{ matrix.step }} $IMAGE_ID:${{ needs.version.outputs.app-version }}
58-
docker push $IMAGE_ID:${{ needs.version.outputs.app-version }}
59-
60-
publish-oci-artifact:
61-
needs:
62-
- container-build
63-
- version
64-
runs-on: ubuntu-latest
65-
steps:
66-
- uses: actions/checkout@v2
67-
68-
- name: Install oras and syft
69-
run: |
70-
ORAS_VERSION="1.2.2"
71-
curl -sL "https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz" | tar -xz oras
72-
sudo mv oras /usr/local/bin/
73-
SYFT_VERSION="1.27.1"
74-
curl -sL "https://github.com/anchore/syft/releases/download/v${SYFT_VERSION}/syft_${SYFT_VERSION}_linux_amd64.tar.gz" | tar -xz syft
75-
sudo mv syft /usr/local/bin/
76-
77-
- name: Authenticate with GitHub Container Registry
78-
run: echo "${{ secrets.GITHUB_TOKEN }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
79-
80-
- name: Prepare CWL files and metadata
81-
run: |
82-
VERSION="${{ needs.version.outputs.app-version }}"
83-
mkdir -p downloads sboms
84-
85-
for step in crop norm_diff otsu stac stac-geoparquet
86-
do
87-
tag="ghcr.io/eoap/advanced-tooling/${step}:${VERSION}"
88-
docker pull "$tag"
89-
digest=$(docker inspect "$tag" | yq -r '.[0]["RepoDigests"][0]')
90-
for cwl in cwl-workflow/*.cwl
91-
do
92-
s="${step}" t="${digest}" yq -i eval '(.$graph[] | select (.id == env(s)) ).hints.DockerRequirement.dockerPull = env(t)' "$cwl"
93-
done
94-
done
95-
96-
for cwl in $(ls cwl-workflow/*.cwl)
97-
do
98-
r=$( cat codemeta.json | jq -r ".codeRepository" ) yq -i eval '."s:codeRepository" = {"URL" : env(r)}' $cwl
99-
v="${{needs.version.outputs.app-version}}" yq -i eval '."s:softwareVersion" = env(v)' $cwl
100-
n=$(cat codemeta.json | jq -r '(.author[0].givenName + " " + .author[0].familyName)') \
101-
e=$(cat codemeta.json | jq -r '.author[0].email') \
102-
a=$(cat codemeta.json | jq -r '.author[0].affiliation["name"]') \
103-
yq eval -i '."s:author" += [{"class": "s:Person", "s.name": env(n), "s.email": env(e), "s.affiliation": env(a)}]' $cwl
104-
done
105-
106-
for cwl in cwl-workflow/*.cwl
107-
do
108-
base=$(basename "$cwl" .cwl)
109-
cp "$cwl" "downloads/${base}.${VERSION}.cwl"
110-
done
111-
112-
- name: Push OCI artifacts and attach SBOMs
113-
run: |
114-
VERSION="${{ needs.version.outputs.app-version }}"
115-
OWNER_REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
116-
set -x
117-
for file in downloads/*.cwl
118-
do
119-
base=$(basename "$file" .${VERSION}.cwl)
120-
ref="ghcr.io/${OWNER_REPO}/${base}:${VERSION}"
121-
122-
echo "Pushing $file as OCI artifact to $ref"
123-
oras push "$ref" --artifact-type application/cwl "$file":application/cwl
124-
125-
echo "Extracting image references from $file"
126-
images=$(yq e '
127-
.["$graph"][]
128-
| select(.class == "CommandLineTool")
129-
| (.hints.DockerRequirement.dockerPull // .requirements.DockerRequirement.dockerPull)
130-
' "$file")
131-
132-
for image in $images
133-
do
134-
safe_name=$(echo "$image" | tr '/@:' '___')
135-
sbom_file="sboms/$safe_name.sbom.spdx.json"
136-
137-
echo "Generating SBOM for $image"
138-
syft "$image" -o spdx-json > "$sbom_file"
139-
140-
echo "Attaching SBOM for $image to $ref"
141-
oras attach "$ref" --artifact-type application/spdx+json "$sbom_file"
142-
done
143-
done
10+
release:
11+
uses: eoap/eoap-cwl-release-workflow/.github/workflows/release-cwl.yml@main
12+
with:
13+
tools: '["crop","norm_diff","otsu","stac","stage","stac-geoparquet"]'
14+
image-prefix: ghcr.io/eoap/advanced-tooling
15+
cwl-dir: cwl-workflow
16+
secrets:
17+
registry-user: ${{ github.actor }}
18+
registry-password: ${{ secrets.GITHUB_TOKEN }}

.trivyignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# GHSA-58pv-8j8x-9vj2
2+
# GitHub Advisory Database – reviewed
3+
# Reason: <explain why this is acceptable>
4+
# Scope: runtime not affected / false positive / upstream fix pending
5+
GHSA-58pv-8j8x-9vj2

command-line-tools/crop/Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
FROM docker.io/library/python:3.10-slim@sha256:80619a5316afae7045a3c13371b0ee670f39bac46ea1ed35081d2bf91d6c3dbd
1+
FROM docker.io/library/python:3.12-slim
2+
# Update base OS packages and clean up
3+
RUN set -eux; \
4+
apt-get update; \
5+
apt-get upgrade -y; \
6+
apt-get install -y --no-install-recommends \
7+
ca-certificates \
8+
gdal-bin \
9+
libgdal-dev \
10+
; \
11+
rm -rf /var/lib/apt/lists/*
212

3-
RUN pip install pip==25.3 setuptools==78.1.1
13+
# Upgrade Python packaging tools
14+
RUN pip install --no-cache-dir \
15+
pip>=25.3 \
16+
setuptools>=78.1.1
417

518
RUN pip install --no-cache-dir rasterio click pystac loguru pyproj shapely && \
619
python -c "import rasterio"

command-line-tools/norm_diff/Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
FROM docker.io/library/python:3.10-slim@sha256:80619a5316afae7045a3c13371b0ee670f39bac46ea1ed35081d2bf91d6c3dbd
1+
FROM docker.io/library/python:3.12-slim
2+
# Update base OS packages and clean up
3+
RUN set -eux; \
4+
apt-get update; \
5+
apt-get upgrade -y; \
6+
apt-get install -y --no-install-recommends \
7+
ca-certificates \
8+
gdal-bin \
9+
libgdal-dev \
10+
; \
11+
rm -rf /var/lib/apt/lists/*
212

3-
RUN pip install pip==25.3 setuptools==78.1.1
13+
# Upgrade Python packaging tools
14+
RUN pip install --no-cache-dir \
15+
pip>=25.3 \
16+
setuptools>=78.1.1
417

518
RUN pip install --no-cache-dir rasterio click loguru && \
619
python -c "import rasterio"

command-line-tools/otsu/Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
FROM docker.io/library/python:3.10-slim@sha256:80619a5316afae7045a3c13371b0ee670f39bac46ea1ed35081d2bf91d6c3dbd
1+
FROM docker.io/library/python:3.12-slim
2+
# Update base OS packages and clean up
3+
RUN set -eux; \
4+
apt-get update; \
5+
apt-get upgrade -y; \
6+
apt-get install -y --no-install-recommends \
7+
ca-certificates \
8+
gdal-bin \
9+
libgdal-dev \
10+
; \
11+
rm -rf /var/lib/apt/lists/*
212

3-
RUN pip install pip==25.3 setuptools==78.1.1
13+
# Upgrade Python packaging tools
14+
RUN pip install --no-cache-dir \
15+
pip>=25.3 \
16+
setuptools>=78.1.1
417

518
RUN pip install --no-cache-dir rasterio scikit-image click loguru && \
619
python -c "import rasterio"

command-line-tools/stac-geoparquet/Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
FROM docker.io/library/python:3.10-slim@sha256:80619a5316afae7045a3c13371b0ee670f39bac46ea1ed35081d2bf91d6c3dbd
1+
FROM docker.io/library/python:3.12-slim
2+
# Update base OS packages and clean up
3+
RUN set -eux; \
4+
apt-get update; \
5+
apt-get upgrade -y; \
6+
apt-get install -y --no-install-recommends \
7+
ca-certificates \
8+
gdal-bin \
9+
libgdal-dev \
10+
; \
11+
rm -rf /var/lib/apt/lists/*
212

3-
RUN pip install pip==25.3 setuptools==78.1.1
13+
# Upgrade Python packaging tools
14+
RUN pip install --no-cache-dir \
15+
pip>=25.3 \
16+
setuptools>=78.1.1
417

518
RUN pip install --no-cache-dir pystac rio_stac loguru click stac_geoparquet && \
619
python -c "import rio_stac"

command-line-tools/stac/Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
FROM docker.io/library/python:3.10-slim@sha256:80619a5316afae7045a3c13371b0ee670f39bac46ea1ed35081d2bf91d6c3dbd
1+
FROM docker.io/library/python:3.12-slim
2+
# Update base OS packages and clean up
3+
RUN set -eux; \
4+
apt-get update; \
5+
apt-get upgrade -y; \
6+
apt-get install -y --no-install-recommends \
7+
ca-certificates \
8+
gdal-bin \
9+
libgdal-dev \
10+
; \
11+
rm -rf /var/lib/apt/lists/*
212

3-
RUN pip install pip==25.3 setuptools==78.1.1
13+
# Upgrade Python packaging tools
14+
RUN pip install --no-cache-dir \
15+
pip>=25.3 \
16+
setuptools>=78.1.1
417

518
RUN pip install --no-cache-dir pystac rio_stac loguru click && \
619
python -c "import rio_stac"
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
FROM docker.io/library/python:3.10-slim@sha256:80619a5316afae7045a3c13371b0ee670f39bac46ea1ed35081d2bf91d6c3dbd
1+
FROM docker.io/library/python:3.12-slim
2+
# Update base OS packages and clean up
3+
RUN set -eux; \
4+
apt-get update; \
5+
apt-get upgrade -y; \
6+
apt-get install -y --no-install-recommends \
7+
ca-certificates \
8+
gdal-bin \
9+
libgdal-dev \
10+
; \
11+
rm -rf /var/lib/apt/lists/*
212

3-
RUN pip install pip==25.3 setuptools==78.1.1
13+
# Upgrade Python packaging tools
14+
RUN pip install --no-cache-dir \
15+
pip>=25.3 \
16+
setuptools>=78.1.1
417

518
RUN pip install --no-cache-dir --upgrade pip stac-asset boto3

params.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
aoi: "-121.399,39.834,-120.74,40.472"
2+
bands: ["green","nir"]
3+
epsg: "EPSG:4326"
4+
stac_items:
5+
- https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs/items/S2A_10TFK_20210708_0_L2A

0 commit comments

Comments
 (0)