Skip to content

Commit

Permalink
Fix permissions for EFS , logging and init commands (#112)
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
  • Loading branch information
gaiksaya authored Apr 27, 2022
1 parent 1770594 commit 476dfae
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
8 changes: 7 additions & 1 deletion lib/compute/jenkins-main-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ export class JenkinsMainNode {
'secretsmanager:GetSecretValue',
'secretsmanager:ListSecrets',
'sts:AssumeRole',
'elasticfilesystem:DescribeFileSystems',
'elasticfilesystem:DescribeMountTargets',
'ec2:DescribeAvailabilityZones',
],
resources: ['*'],
})],
Expand Down Expand Up @@ -364,7 +367,8 @@ export class JenkinsMainNode {
InitCommand.shellCommand('sleep 90'),

// Download jenkins-cli from the local machine
InitCommand.shellCommand('wget -O "jenkins-cli.jar" http://localhost:8080/jnlpJars/jenkins-cli.jar'),
InitCommand.shellCommand('until $(curl --output /dev/null --silent --head --fail http://localhost:8080); do sleep 5; done &&'
+' wget -O "jenkins-cli.jar" http://localhost:8080/jnlpJars/jenkins-cli.jar'),

InitFile.fromFileInline('/initial_jenkins.yaml', jenkinsyaml),

Expand All @@ -377,6 +381,8 @@ export class JenkinsMainNode {
+ ' for i in $varkeys; do newvalue=`echo $var | yq .$i` && myenv=$newvalue i=$i yq -i \'.jenkins.securityRealm.oic.[env(i)]=env(myenv)\' /initial_jenkins.yaml ; done'
: 'echo No changes made to initial_jenkins.yaml with respect to OIDC'),

InitCommand.shellCommand('sleep 30'),

// Reload configuration via Jenkins.yaml
InitCommand.shellCommand('cp /initial_jenkins.yaml /var/lib/jenkins/jenkins.yaml &&'
+ ' java -jar /jenkins-cli.jar -s http://localhost:8080 reload-jcasc-configuration'),
Expand Down
2 changes: 0 additions & 2 deletions resources/baseJenkins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jenkins:
name: "all"
projectNamingStrategy: "standard"
quietPeriod: 5
remotingSecurity:
enabled: true
scmCheckoutRetryCount: 0
securityRealm:
local:
Expand Down
1 change: 1 addition & 0 deletions resources/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
jenkins:
image: opensearchstaging/jenkins:latest
privileged: true
tty: true
user: root
ports:
- 8080:8080
Expand Down
2 changes: 1 addition & 1 deletion test/compute/jenkins-main-node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('JenkinsMainNode Config Elements', () => {

// THEN
test('Config elements expected counts', async () => {
expect(configElements.filter((e) => e.elementType === 'COMMAND')).toHaveLength(18);
expect(configElements.filter((e) => e.elementType === 'COMMAND')).toHaveLength(19);
expect(configElements.filter((e) => e.elementType === 'PACKAGE')).toHaveLength(10);
expect(configElements.filter((e) => e.elementType === 'FILE')).toHaveLength(4);
});
Expand Down

0 comments on commit 476dfae

Please sign in to comment.