Closed mszostok closed 2 years ago
Changes proposed in this pull request:
backend: context: provider: dotenv id: 60b65fe1-df56-4552-8f67-aa2a86452bd0 # new field value: key: Implementation A
You can use it later to render other TypeInstance:
- - name: render-ti capact-action: jinja2.template arguments: artifacts: - name: template raw: data: | backend: context: repositoryDetails: typeInstanceID: "<@ id @>" write: strategy: merge fileMapping: foo: bar - name: input-parameters from: "{{workflow.outputs.artifacts.repo}}" - name: configuration raw: data: ""
The e2e test proves that it works.
Patch backend to simulate update context:
cat <<EOF | git apply - diff --git a/internal/secret-storage-backend/server.go b/internal/secret-storage-backend/server.go index d4f171b9..2edf3054 100644 --- a/internal/secret-storage-backend/server.go +++ b/internal/secret-storage-backend/server.go @@ -183,7 +183,9 @@ func (h *Handler) OnUpdate(_ context.Context, request *pb.OnUpdateValueAndContex return nil, err } - return &pb.OnUpdateResponse{}, nil + return &pb.OnUpdateResponse{ + Context: []byte("{\"updatekey\": \"updateVal2\"}"), + }, nil } // OnLock handles TypeInstance locking by setting a secret entry in a given provider. EOF
Run Backend:
APP_SUPPORTED_PROVIDERS=dotenv APP_LOGGER_DEV_MODE=true go run ./cmd/secret-storage-backend/main.go
Run Local Hub:
APP_LOGGER_LEVEL="debug" APP_NEO4J_ENDPOINT=bolt://localhost:7687 APP_NEO4J_PASSWORD=okon APP_HUB_MODE=local npm run dev
Create dotenv backend:
dotenv
cat > /tmp/dotenv-ti.yaml << ENDOFFILE typeInstances: - alias: aws-backend typeRef: path: cap.type.aws.secrets-manager.storage revision: 0.1.0 value: url: "localhost:50051" acceptValue: true contextSchema: { "type": "object", "additionalProperties": true } ENDOFFILE capact typeinstance create -f /tmp/dotenv-ti.yaml -ojson
Create TypeInstance:
mutation CreateTypeInstancesWithCtxEmpty { createTypeInstances( in: { typeInstances: [ { alias: "static-data" typeRef: { path: "cap.type.static.data", revision: "0.1.0" } value: { key: "test" } backend: { id: <backend_id_from_previous_step> } } ] usesRelations: [] } ) { id alias } }
Update TypeInstance:
mutation UpdateData($typeInstanceID: ID!) { updateTypeInstances( in: [ { id: $typeInstanceID, typeInstance: { value: { name: "update v4" } } } ] ) { ...TypeInstance } } fragment TypeInstance on TypeInstance { id createdAt { formatted } typeRef { path revision } lockedBy backend { id abstract } latestResourceVersion { ...TypeInstanceResourceVersion } } fragment TypeInstanceResourceVersion on TypeInstanceResourceVersion { resourceVersion createdBy metadata { attributes { path revision } } spec { value backend { context } } }
Variable:
{ "typeInstanceID": "ac3b5dfa-d7e6-4579-a5f5-9ae2fe0b22b6" }
Description
Changes proposed in this pull request:
You can use it later to render other TypeInstance:
Testing
Passing TypeInstance ID
The e2e test proves that it works.
Update context
Patch backend to simulate update context:
Run Backend:
Run Local Hub:
Create
dotenv
backend:Create TypeInstance:
Update TypeInstance:
Variable:
Related issue(s)