Skip to content

Commit ffcd54b

Browse files
authored
Merge pull request #15 from alphagov/samsimpson1/publish-fix
Fix publish workflow not having permission to push to GHCR
2 parents 5bb20c7 + a2a1777 commit ffcd54b

5 files changed

Lines changed: 135 additions & 10 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ jobs:
88
permissions:
99
contents: write
1010
packages: write
11-
id-token: write
1211
steps:
1312
- name: Login to GitHub Container Registry
1413
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
1514
with:
1615
registry: ghcr.io
17-
username: ${{ github.repository_owner }}
16+
username: ${{ github.actor }}
1817
password: ${{ secrets.GITHUB_TOKEN }}
1918
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2019
with:

api/v1/groupversion_info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616

1717
// Package v1 contains API Schema definitions for the platform v1 API group.
1818
// +kubebuilder:object:generate=true
19-
// +groupName=platform.gov.uk
19+
// +groupName=platform.publishing.service.gov.uk
2020
package v1
2121

2222
import (
@@ -27,7 +27,7 @@ import (
2727
var (
2828
// SchemeGroupVersion is group version used to register these objects.
2929
// This name is used by applyconfiguration generators (e.g. controller-gen).
30-
SchemeGroupVersion = schema.GroupVersion{Group: "platform.gov.uk", Version: "v1"}
30+
SchemeGroupVersion = schema.GroupVersion{Group: "platform.publishing.service.gov.uk", Version: "v1"}
3131

3232
// GroupVersion is an alias for SchemeGroupVersion, for backward compatibility.
3333
GroupVersion = SchemeGroupVersion
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.20.1
7+
name: jobrequests.platform.publishing.service.gov.uk
8+
spec:
9+
group: platform.publishing.service.gov.uk
10+
names:
11+
kind: JobRequest
12+
listKind: JobRequestList
13+
plural: jobrequests
14+
singular: jobrequest
15+
scope: Namespaced
16+
versions:
17+
- name: v1
18+
schema:
19+
openAPIV3Schema:
20+
description: JobRequest is the Schema for the jobrequests API
21+
properties:
22+
apiVersion:
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
28+
type: string
29+
kind:
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
36+
type: string
37+
metadata:
38+
type: object
39+
spec:
40+
description: spec defines the desired state of JobRequest
41+
properties:
42+
foo:
43+
description: foo is an example field of JobRequest. Edit jobrequest_types.go
44+
to remove/update
45+
type: string
46+
type: object
47+
status:
48+
description: status defines the observed state of JobRequest
49+
properties:
50+
conditions:
51+
description: |-
52+
conditions represent the current state of the JobRequest resource.
53+
Each condition has a unique type and reflects the status of a specific aspect of the resource.
54+
55+
Standard condition types include:
56+
- "Available": the resource is fully functional
57+
- "Progressing": the resource is being created or updated
58+
- "Degraded": the resource failed to reach or maintain its desired state
59+
60+
The status of each condition is one of True, False, or Unknown.
61+
items:
62+
description: Condition contains details for one aspect of the current
63+
state of this API Resource.
64+
properties:
65+
lastTransitionTime:
66+
description: |-
67+
lastTransitionTime is the last time the condition transitioned from one status to another.
68+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
69+
format: date-time
70+
type: string
71+
message:
72+
description: |-
73+
message is a human readable message indicating details about the transition.
74+
This may be an empty string.
75+
maxLength: 32768
76+
type: string
77+
observedGeneration:
78+
description: |-
79+
observedGeneration represents the .metadata.generation that the condition was set based upon.
80+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
81+
with respect to the current state of the instance.
82+
format: int64
83+
minimum: 0
84+
type: integer
85+
reason:
86+
description: |-
87+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
88+
Producers of specific condition types may define expected values and meanings for this field,
89+
and whether the values are considered a guaranteed API.
90+
The value should be a CamelCase string.
91+
This field may not be empty.
92+
maxLength: 1024
93+
minLength: 1
94+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
95+
type: string
96+
status:
97+
description: status of the condition, one of True, False, Unknown.
98+
enum:
99+
- "True"
100+
- "False"
101+
- Unknown
102+
type: string
103+
type:
104+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
105+
maxLength: 316
106+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
107+
type: string
108+
required:
109+
- lastTransitionTime
110+
- message
111+
- reason
112+
- status
113+
- type
114+
type: object
115+
type: array
116+
x-kubernetes-list-map-keys:
117+
- type
118+
x-kubernetes-list-type: map
119+
type: object
120+
required:
121+
- spec
122+
type: object
123+
served: true
124+
storage: true
125+
subresources:
126+
status: {}

config/rbac/role.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
name: manager-role
66
rules:
77
- apiGroups:
8-
- platform.gov.uk
8+
- platform.publishing.service.gov.uk
99
resources:
1010
- jobrequests
1111
verbs:
@@ -17,13 +17,13 @@ rules:
1717
- update
1818
- watch
1919
- apiGroups:
20-
- platform.gov.uk
20+
- platform.publishing.service.gov.uk
2121
resources:
2222
- jobrequests/finalizers
2323
verbs:
2424
- update
2525
- apiGroups:
26-
- platform.gov.uk
26+
- platform.publishing.service.gov.uk
2727
resources:
2828
- jobrequests/status
2929
verbs:

internal/controller/jobrequest_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ type JobRequestReconciler struct {
3333
Scheme *runtime.Scheme
3434
}
3535

36-
// +kubebuilder:rbac:groups=platform.gov.uk,resources=jobrequests,verbs=get;list;watch;create;update;patch;delete
37-
// +kubebuilder:rbac:groups=platform.gov.uk,resources=jobrequests/status,verbs=get;update;patch
38-
// +kubebuilder:rbac:groups=platform.gov.uk,resources=jobrequests/finalizers,verbs=update
36+
// +kubebuilder:rbac:groups=platform.publishing.service.gov.uk,resources=jobrequests,verbs=get;list;watch;create;update;patch;delete
37+
// +kubebuilder:rbac:groups=platform.publishing.service.gov.uk,resources=jobrequests/status,verbs=get;update;patch
38+
// +kubebuilder:rbac:groups=platform.publishing.service.gov.uk,resources=jobrequests/finalizers,verbs=update
3939

4040
// Reconcile is part of the main kubernetes reconciliation loop which aims to
4141
// move the current state of the cluster closer to the desired state.

0 commit comments

Comments
 (0)