fix(ci): use go-yq (#3351)

* migrato to python yq

* fix(ci): use go-yq

* only update sources if dep are installed

* bump dev container
This commit is contained in:
Stavros Kois
2022-07-31 13:54:01 +03:00
committed by GitHub
parent f8e6edbf06
commit 2f5f341454
4 changed files with 52 additions and 44 deletions
+25 -21
View File
@@ -32,27 +32,31 @@ sync_tag() {
sed -i -e "s|icon: .*|icon: https:\/\/truecharts.org\/img\/chart-icons\/${chartname}.png|" "${chart}/Chart.yaml" sed -i -e "s|icon: .*|icon: https:\/\/truecharts.org\/img\/chart-icons\/${chartname}.png|" "${chart}/Chart.yaml"
echo "Updating home of ${chartname}..." echo "Updating home of ${chartname}..."
sed -i -e "s|home: .*|home: https:\/\/truecharts.org\/docs\/charts\/${train}\/${chartname}|" "${chart}/Chart.yaml" sed -i -e "s|home: .*|home: https:\/\/truecharts.org\/docs\/charts\/${train}\/${chartname}|" "${chart}/Chart.yaml"
echo "Updating sources of ${chartname}..." echo "Attempting to update sources of ${chartname}..."
yq -V # Only update source if go-yq is installed
# Get all sources (except truecharts) if [ $(command -v go-yq) ]; then
curr_sources=$(yq '.sources[] | select(. != "https://github.com/truecharts*")' "${chart}/Chart.yaml") go-yq -V
echo "${chartname}: $curr_sources" # Get all sources (except truecharts)
echo "${chartname}: After getting all sources" curr_sources=$(go-yq '.sources[] | select(. != "https://github.com/truecharts*")' "${chart}/Chart.yaml")
cat "${chart}/Chart.yaml" echo "${chartname}: $curr_sources"
# Empty sources list in-place echo "${chartname}: After getting all sources"
yq -yi 'del(.sources.[])' "${chart}/Chart.yaml" cat "${chart}/Chart.yaml"
echo "${chartname}: After deleting all sources" # Empty sources list in-place
cat "${chart}/Chart.yaml" go-yq -i 'del(.sources.[])' "${chart}/Chart.yaml"
# Add truechart source echo "${chartname}: After deleting all sources"
tcsource="https://github.com/truecharts/charts/tree/master/charts/$train/$chartname" yq -yi '.sources += env(tcsource)' "${chart}/Chart.yaml" cat "${chart}/Chart.yaml"
echo "${chartname}: After adding tc source" # Add truechart source
cat "${chart}/Chart.yaml" tcsource="https://github.com/truecharts/charts/tree/master/charts/$train/$chartname" go-yq -i '.sources += env(tcsource)' "${chart}/Chart.yaml"
# Add the rest of the sources echo "${chartname}: After adding tc source"
while IFS= read -r line; do cat "${chart}/Chart.yaml"
src="$line" yq -yi '.sources += env(src)' "${chart}/Chart.yaml" # Add the rest of the sources
done <<< "$curr_sources" while IFS= read -r line; do
echo "${chartname}: After adding the rest of the sources" src="$line" go-yq -i '.sources += env(src)' "${chart}/Chart.yaml"
cat "${chart}/Chart.yaml" done <<< "$curr_sources"
echo "${chartname}: After adding the rest of the sources"
cat "${chart}/Chart.yaml"
echo "Sources of ${chartname} updated!"
fi;
} }
export -f sync_tag export -f sync_tag
+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
name: Test SCALE Catalog name: Test SCALE Catalog
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: ghcr.io/truecharts/devcontainer:v2.4.0@sha256:395ee7ed8b9cba6569ddeba77b7ceb86fdb79b91a19c639625d7bc54cb1ccc1d image: ghcr.io/truecharts/devcontainer:v2.6.0@sha256:395ee7ed8b9cba6569ddeba77b7ceb86fdb79b91a19c639625d7bc54cb1ccc1d
steps: steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
name: Checkout name: Checkout
+1 -1
View File
@@ -14,7 +14,7 @@ jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: ghcr.io/truecharts/devcontainer:v2.4.0@sha256:395ee7ed8b9cba6569ddeba77b7ceb86fdb79b91a19c639625d7bc54cb1ccc1d image: ghcr.io/truecharts/devcontainer:v2.6.0@sha256:395ee7ed8b9cba6569ddeba77b7ceb86fdb79b91a19c639625d7bc54cb1ccc1d
concurrency: gitpush concurrency: gitpush
steps: steps:
- name: Install Kubernetes tools - name: Install Kubernetes tools
+25 -21
View File
@@ -301,27 +301,31 @@ sync_tag() {
sed -i -e "s|icon: .*|icon: https:\/\/truecharts.org\/img\/chart-icons\/${chartname}.png|" "${chart}/Chart.yaml" sed -i -e "s|icon: .*|icon: https:\/\/truecharts.org\/img\/chart-icons\/${chartname}.png|" "${chart}/Chart.yaml"
echo "Updating home of ${chartname}..." echo "Updating home of ${chartname}..."
sed -i -e "s|home: .*|home: https:\/\/truecharts.org\/docs\/charts\/${train}\/${chartname}|" "${chart}/Chart.yaml" sed -i -e "s|home: .*|home: https:\/\/truecharts.org\/docs\/charts\/${train}\/${chartname}|" "${chart}/Chart.yaml"
echo "Updating sources of ${chartname}..." echo "Attempting to update sources of ${chartname}..."
yq -V # Only update source if go-yq is installed
# Get all sources (except truecharts) if [ $(command -v go-yq) ]; then
curr_sources=$(yq '.sources[] | select(. != "https://github.com/truecharts*")' "${chart}/Chart.yaml") go-yq -V
echo "${chartname}: $curr_sources" # Get all sources (except truecharts)
echo "${chartname}: After getting all sources" curr_sources=$(go-yq '.sources[] | select(. != "https://github.com/truecharts*")' "${chart}/Chart.yaml")
cat "${chart}/Chart.yaml" echo "${chartname}: $curr_sources"
# Empty sources list in-place echo "${chartname}: After getting all sources"
yq -yi 'del(.sources.[])' "${chart}/Chart.yaml" cat "${chart}/Chart.yaml"
echo "${chartname}: After deleting all sources" # Empty sources list in-place
cat "${chart}/Chart.yaml" go-yq -i 'del(.sources.[])' "${chart}/Chart.yaml"
# Add truechart source echo "${chartname}: After deleting all sources"
tcsource="https://github.com/truecharts/charts/tree/master/charts/$train/$chartname" yq -yi '.sources += env(tcsource)' "${chart}/Chart.yaml" cat "${chart}/Chart.yaml"
echo "${chartname}: After adding tc source" # Add truechart source
cat "${chart}/Chart.yaml" tcsource="https://github.com/truecharts/charts/tree/master/charts/$train/$chartname" go-yq -i '.sources += env(tcsource)' "${chart}/Chart.yaml"
# Add the rest of the sources echo "${chartname}: After adding tc source"
while IFS= read -r line; do cat "${chart}/Chart.yaml"
src="$line" yq -yi '.sources += env(src)' "${chart}/Chart.yaml" # Add the rest of the sources
done <<< "$curr_sources" while IFS= read -r line; do
echo "${chartname}: After adding the rest of the sources" src="$line" go-yq -i '.sources += env(src)' "${chart}/Chart.yaml"
cat "${chart}/Chart.yaml" done <<< "$curr_sources"
echo "${chartname}: After adding the rest of the sources"
cat "${chart}/Chart.yaml"
echo "Sources of ${chartname} updated!"
fi;
} }
export -f sync_tag export -f sync_tag