Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
alice: shouldi: contribute: cicd: Boolean labels added via overlay
Browse files Browse the repository at this point in the history
Install Alice: https://github.com/intel/dffml/tree/alice/entities/alice/

```console
$ python -m venv .venv
$ . .venv/bin/activate
$ python -m pip install -U pip setuptools wheel
$ export ALICE_STATE_OF_ART=98335d941116e76bbf4e07422adc2b5061e47934
$ python -m pip install \
    "https://github.com/intel/dffml/archive/${ALICE_STATE_OF_ART}.zip#egg=dffml" \
    "https://github.com/intel/dffml/archive/${ALICE_STATE_OF_ART}.zip#egg=dffml-feature-git&subdirectory=feature/git" \
    "https://github.com/intel/dffml/archive/${ALICE_STATE_OF_ART}.zip#egg=shouldi&subdirectory=examples/shouldi" \
    "https://github.com/intel/dffml/archive/${ALICE_STATE_OF_ART}.zip#egg=dffml-config-yaml&subdirectory=configloader/yaml" \
    "https://github.com/intel/dffml/archive/${ALICE_STATE_OF_ART}.zip#egg=dffml-operations-innersource&subdirectory=operations/innersource" \
    "https://github.com/intel/dffml/archive/${ALICE_STATE_OF_ART}.zip#egg=alice&subdirectory=entities/alice"
```

Install this overlay (from this commit in this example):

```console
$ python -m pip install --upgrade "git+https://github.com/intel/dffml@d2a38d47445241fc99d26bc2a51184caa88bd033#subdirectory=entities/alice"
```

Collect metrics on a repo using `alice shouldi contribute`:

```console
$ alice -log debug shouldi contribute -keys https://github.com/pdxjohnny/httptest 2>&1 | tee .alice.shouldi.contribute.log.$(date "+%4Y-%m-%d-%H-%M").txt
$ alice -log debug shouldi contribute -record-def GitHubRepoID -keys 149512216 2>&1 | tee .alice.shouldi.contribute.log.$(date "+%4Y-%m-%d-%H-%M").txt
$ python -c 'import yaml, json, sys; print(yaml.dump(json.load(sys.stdin)))' < .tools/open-architecture/innersource/repos.json
untagged:
  https://github.com/aliceoa/example-github-action:
    features:
      alice.shouldi.contribute.cicd:cicd_action_library:
        result: true
      group_by:
        ActionYAMLFileWorkflowUnixStylePath:
        - my_action_name/action.yml
```

Engineering Log: #1406 (reply in thread)
Signed-off-by: John Andersen <[email protected]>
  • Loading branch information
pdxjohnny authored and john-s-andersen committed Sep 28, 2022
1 parent 17ccb5b commit 90d5c52
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
43 changes: 43 additions & 0 deletions entities/alice/alice/shouldi/contribute/cicd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from typing import NewType

import dffml
import dffml_operations_innersource.operations


IsCICDJenkinsLibrary = NewType("IsCICDJenkinsLibrary", bool)
IsCICDGitHubActionsLibrary = NewType("IsCICDGitHubActionsLibrary", bool)
CICDLibrary = NewType("CICDLibrary", dict)


@dffml.op(
stage=dffml.Stage.OUTPUT,
)
def cicd_library(
self,
cicd_jenkins_library: IsCICDJenkinsLibrary,
cicd_action_library: IsCICDGitHubActionsLibrary,
) -> CICDLibrary:
return {
"cicd-jenkins-library": cicd_jenkins_library,
"cicd-action-library": cicd_action_library,
}


@dffml.op(
stage=dffml.Stage.OUTPUT,
)
def cicd_jenkins_library(
self,
groovy_file_paths: dffml_operations_innersource.operations.GroovyFileWorkflowUnixStylePath,
) -> IsCICDJenkinsLibrary:
return bool(groovy_file_paths)


@dffml.op(
stage=dffml.Stage.OUTPUT,
)
def cicd_action_library(
self,
action_file_paths: dffml_operations_innersource.operations.ActionYAMLFileWorkflowUnixStylePath,
) -> IsCICDGitHubActionsLibrary:
return bool(action_file_paths)
3 changes: 3 additions & 0 deletions entities/alice/entry_points.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ OverlayGitHub = alice.please.contribute.recomme
[dffml.overlays.alice.please.contribute.recommended_community_standards.code_of_conduct]
OverlayGit = alice.please.contribute.recommended_community_standards.recommended_community_standards:OverlayGit
OverlayGitHub = alice.please.contribute.recommended_community_standards.recommended_community_standards:OverlayGitHub

[dffml.overlays.alice.shouldi.contribute]
OverlayCICDLibrary = alice.shouldi.contribute.cicd

1 comment on commit 90d5c52

@johnandersen777
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions unfortunately I don't think work from this commit message, because it's the same main package, we need to setup the lightweight package stuff as was done here: https://github.com/intel/dffml/pull/1171/files#diff-adf9f7e749772a155d64fb54eedca256d8e6401831a9a3dac6536d0cef8de707R306-R368

Please sign in to comment.