Skip to content

Commit

Permalink
Adds a ClowderJob to create insights-cicd resources (#79)
Browse files Browse the repository at this point in the history
Creates a insights-cicd user and domain that belongs to that user.
Creates a rubygems.org pull through cache.

PULP-59
  • Loading branch information
dkliban authored May 6, 2024
1 parent ca45f46 commit db4cc31
Showing 1 changed file with 76 additions and 3 deletions.
79 changes: 76 additions & 3 deletions deploy/clowdapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ objects:
openssl rand -base64 32 | tr -d '\n' > /tmp/password
kubectl create secret generic pulp-content-sources-password --from-file /tmp/password
# Generate insights-cicd user password
openssl rand -base64 32 | tr -d '\n' > /tmp/password
kubectl create secret generic pulp-insights-cicd-password --from-file /tmp/password
# Generate insights-cicd s3 bucket info
kubectl create secret generic insights-cicd-s3 \
--from-literal=bucket_name=my-bucket \
--from-literal=access_key=my-access-key \
--from-literal=secret_key=my-secret-key
# Create settings.py
cat <<EOF > /tmp/settings.py
# Auto-generated settings file
Expand Down Expand Up @@ -497,6 +507,70 @@ objects:
value: "/tmp"
- name: XDG_CACHE_HOME
value: "/tmp"
- name: create-insights-cicd
podSpec:
image: ${IMAGE}:${IMAGE_TAG}
command: [ '/bin/sh' ]
args:
- "-c"
- |
pulpcore-manager reset-admin-password --password "$PULP_ADMIN_PASSWORD"
pulp config create --base-url http://pulp-api-svc:24817 --api-root /api/pulp/ --username admin --password "$PULP_ADMIN_PASSWORD" --domain default
pulp role create --name insights.cicd.admin --permission core.add_domain --permission core.add_headercontentguard --permission core.add_compositecontentguard --permission rpm.add_rpmrepository --permission rpm.add_rpmremote --permission rpm.add_rpmdistribution --permission rpm.add_rpmpublication --permission gem.add_gemdistribution --permission gem.add_gempublication --permission gem.add_gemremote --permission gem.add_gemrepository
pulp user create --username insights-cicd --password "$INSIGHTS_CICD_PASSWORD"
pulp user role-assignment add --username insights-cicd --role insights.cicd.admin --object ""
pulp config create --overwrite --base-url http://pulp-api-svc:24817 --api-root /api/pulp/ --username insights-cicd --password "$INSIGHTS_CICD_PASSWORD" --domain insights-cicd
pulp --domain default domain create --name insights-cicd --storage-class storages.backends.s3boto3.S3Boto3Storage --storage-settings "{\"access_key\": \"$INSIGHTS_ACCESS_KEY\", \"secret_key\": \"$INSIGHTS_SECRET_KEY\", \"bucket_name\": \"$INSIGHTS_BUCKET_NAME\", \"region_name\": \"us-east-1\", \"default_acl\": \"private\"}" || true
pulp gem remote create --name rubygems.org --url https://index.rubygems.org/ || true
pulp gem distribution create --name rubygems.org.cache --base-path rubygems --remote rubygems.org || true
env:
- name: PULP_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: pulp-admin-password
key: password
optional: false
- name: INSIGHTS_CICD_PASSWORD
valueFrom:
secretKeyRef:
name: pulp-insights-cicd-password
key: password
optional: false
- name: INSIGHTS_BUCKET_NAME
valueFrom:
secretKeyRef:
name: insights-cicd-s3
key: bucket_name
optional: true
- name: INSIGHTS_ACCESS_KEY
valueFrom:
secretKeyRef:
name: insights-cicd-s3
key: access_key
optional: true
- name: INSIGHTS_SECRET_KEY
valueFrom:
secretKeyRef:
name: insights-cicd-s3
key: secret_key
optional: true
- name: XDG_CONFIG_HOME
value: "/tmp"
- name: XDG_CACHE_HOME
value: "/tmp"
volumeMounts:
- name: secret-volume
mountPath: "/etc/pulp/keys"
- name: pulp-settings
mountPath: "/etc/pulp/settings.py"
subPath: "settings.py"
volumes:
- name: secret-volume
secret:
secretName: pulp-db-fields-encryption
- name: pulp-settings
secret:
secretName: pulp-settings
- name: print-settings
podSpec:
image: ${IMAGE}:${IMAGE_TAG}
Expand Down Expand Up @@ -610,12 +684,11 @@ objects:
- apiVersion: cloud.redhat.com/v1alpha1
kind: ClowdJobInvocation
metadata:
name: pulp-print-settings
name: create-insights-cicd
spec:
appName: pulp
runOnNotReady: True
jobs:
- print-settings
- create-insights-cicd

parameters:
- name: ENV_NAME
Expand Down

0 comments on commit db4cc31

Please sign in to comment.