Skip to content

Commit

Permalink
Merge branch 'master' into changelogs-2.65
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestl committed Aug 23, 2024
2 parents 006495b + d32a5ae commit d37ae1a
Show file tree
Hide file tree
Showing 90 changed files with 6,742 additions and 813 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -790,13 +790,17 @@ jobs:
if: "!contains(github.event.pull_request.labels.*.name, 'Skip spread')"
run: |
# Configure parameters to filter logs (these logs are sent read by grafana agent)
CHANGE_ID="pr${{ github.event.number }}"
CHANGE_ID="${{ github.event.number }}"
if [ -z "$CHANGE_ID" ]; then
CHANGE_ID="main"
fi
CHANGE_ID="${CHANGE_ID}_n${{ github.run_attempt }}_run${{ github.run_id }}_gh"
FILTERED_LOG_FILE="spread_${CHANGE_ID}_n${{ github.run_attempt }}.filtered.log"
# The log-filter tool is used to filter the spread logs to be stored
echo FILTER_PARAMS="-o spread_${CHANGE_ID}.filtered.log -e Debug -e WARNING: -f Failed=NO_LINES -f Error=NO_LINES" >> $GITHUB_ENV
echo FILTER_PARAMS="-o $FILTERED_LOG_FILE -e Debug -e WARNING: -f Failed=NO_LINES -f Error=NO_LINES" >> $GITHUB_ENV
echo FILTERED_LOG_FILE="$FILTERED_LOG_FILE" >> $GITHUB_ENV
# Add start line to filtered log
echo "GRAFANA START: pr ${CHANGE_ID} attempt ${{ github.run_attempt }} run ${{ github.run_id }} group ${{ matrix.group }}" > "$FILTERED_LOG_FILE"
- name: Download built snap
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -879,24 +883,24 @@ jobs:
spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')";
done
- name: report spread errors
- name: Report spread errors
if: always()
run: |
if [ -e spread.log ]; then
echo "Running spread log analyzer"
issues_metadata='{"source_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}'
PYTHONDONTWRITEBYTECODE=1 ./tests/lib/external/snapd-testing-tools/utils/log-parser spread.log --output spread-results.json --cut 100
ACTIONS_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}"
PYTHONDONTWRITEBYTECODE=1 ./tests/lib/external/snapd-testing-tools/utils/log-parser spread.log --output spread-results.json --cut 1 >/dev/null
while IFS= read -r line; do
if [ ! -z "$line" ]; then
echo "Reporting spread error..."
./tests/lib/tools/report-mongodb --db-name snapd --db-collection spread_errors --metadata "$issues_metadata" "$line"
echo "Adding failed test line to filtered log"
echo "GRAFANA FAILED: $line $ACTIONS_URL" | tee -a "$FILTERED_LOG_FILE"
fi
done <<< $(jq -cr '.[] | select( .type == "info") | select( (.info_type == "Error") or (.info_type == "Debug"))' spread-results.json)
done <<< $(jq -r '.[] | select( .type == "info" ) | select( .info_type == "Error" ) | "\(.verb) \(.task)"' spread-results.json)
else
echo "No spread log found, skipping errors reporting"
fi
- name: analyze spread test results
- name: Analyze spread test results
if: always()
run: |
if [ -f spread.log ]; then
Expand All @@ -918,7 +922,7 @@ jobs:
touch "$FAILED_TESTS_FILE"
fi
- name: save spread test results to cache
- name: Save spread test results to cache
if: always()
uses: actions/cache/save@v3
with:
Expand Down
27 changes: 27 additions & 0 deletions client/systems.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@ type SystemDetails struct {
Volumes map[string]*gadget.Volume `json:"volumes,omitempty"`

StorageEncryption *StorageEncryption `json:"storage-encryption,omitempty"`

// AvailableOptional contains the optional snaps and components that are
// available in this system.
AvailableOptional AvailableForInstall `json:"available-optional"`
}

// AvailableForInstall contains information about snaps and components that are
// optional in the system's model, but are available for installation.
type AvailableForInstall struct {
// Snaps contains the names of optional snaps that are available for installation.
Snaps []string `json:"snaps,omitempty"`
// Components contains a mapping of snap names to lists of the names of
// optional components that are available for installation.
Components map[string][]string `json:"components,omitempty"`
}

func (client *Client) SystemDetails(systemLabel string) (*SystemDetails, error) {
Expand Down Expand Up @@ -221,6 +235,19 @@ type InstallSystemOptions struct {
// OnVolumes is the volume description of the volumes that the
// given step should operate on.
OnVolumes map[string]*gadget.Volume `json:"on-volumes,omitempty"`
// OptionalInstall contains the optional snaps and components that should be
// installed on the system. Omitting this field will result in all optional
// snaps and components being installed. To install none of the optional
// snaps and components, provide an empty OptionalInstallRequest with the
// All field set to false.
OptionalInstall *OptionalInstallRequest `json:"optional-install,omitempty"`
}

type OptionalInstallRequest struct {
AvailableForInstall
// All is true if all optional snaps and components should be installed. It
// is invalid to set both All and the individual fields in AvailableForInstall.
All bool `json:"all,omitempty"`
}

// InstallSystem will perform the given install step for the given volumes
Expand Down
6 changes: 3 additions & 3 deletions daemon/api_aliases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ func (s *aliasesSuite) TestInstallUnaliased(c *check.C) {
st := d.Overlord().State()
st.Lock()
defer st.Unlock()
_, _, err := inst.Dispatch()(context.Background(), inst, st)
_, err := inst.Dispatch()(context.Background(), inst, st)
c.Check(err, check.IsNil)

c.Check(calledFlags.Unaliased, check.Equals, true)
Expand All @@ -635,7 +635,7 @@ func (s *aliasesSuite) TestInstallIgnoreRunning(c *check.C) {
st := d.Overlord().State()
st.Lock()
defer st.Unlock()
_, _, err := inst.Dispatch()(context.Background(), inst, st)
_, err := inst.Dispatch()(context.Background(), inst, st)
c.Check(err, check.IsNil)

c.Check(calledFlags.IgnoreRunning, check.Equals, true)
Expand All @@ -661,7 +661,7 @@ func (s *aliasesSuite) TestInstallPrefer(c *check.C) {
st := d.Overlord().State()
st.Lock()
defer st.Unlock()
_, _, err := inst.Dispatch()(context.Background(), inst, st)
_, err := inst.Dispatch()(context.Background(), inst, st)
c.Check(err, check.IsNil)

c.Check(calledFlags.Prefer, check.Equals, true)
Expand Down
Loading

0 comments on commit d37ae1a

Please sign in to comment.